diff --git a/app/Scraper/Edomizil.php b/app/Scraper/Edomizil.php index b152a17..0301cea 100644 --- a/app/Scraper/Edomizil.php +++ b/app/Scraper/Edomizil.php @@ -7,6 +7,7 @@ use App\Models\Extraction; use App\Models\Exception; use App\Jobs\ScrapeProperty; use App\Jobs\ScrapePropertyData; +use Carbon\Carbon; use Illuminate\Support\Facades\Http; class Edomizil{ @@ -37,8 +38,9 @@ class Edomizil{ public static function getAllProperties() { - // get all properties from model in random order. - return Property::select('id','property_platform_id')->inRandomOrder()->get(); + // get all properties from model in random order, + // which where found at least in the last six days. + return Property::select('id','property_platform_id')->inRandomOrder()->where('last_found', '>=', Carbon::now()->subDays(6)->toDateTimeString())->get(); } public static function dispatchPropertyJobs() diff --git a/composer.json b/composer.json index 8a3d72d..60e88b6 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.10", "laravel/sanctum": "^3.3", - "laravel/tinker": "^2.8" + "laravel/tinker": "^2.8", + "nesbot/carbon": "^2.72" }, "require-dev": { "fakerphp/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index e7a4f62..5a4b8ac 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9c491b8531eec05ba41a11d9276a5749", + "content-hash": "bc5b2fc4cb90f140935255d65fb7ffb2", "packages": [ { "name": "brick/math",