Only scrape properties which were found in the last six days

main
Giò 2024-08-02 22:01:17 +02:00
parent 2d88f463e4
commit 1cb6d633ab
3 changed files with 7 additions and 4 deletions

View File

@ -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()

View File

@ -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",

2
composer.lock generated
View File

@ -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",