ConsultancyProject1_Auslast.../scraper/app/Jobs/ScrapePropertyData.php

34 lines
723 B
PHP
Raw Normal View History

2024-04-09 22:36:40 +02:00
<?php
namespace App\Jobs;
2024-04-13 16:11:18 +02:00
use App\Scraper\Edomizil;
2024-04-09 22:36:40 +02:00
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
2024-04-13 16:11:18 +02:00
class ScrapePropertyData implements ShouldQueue
2024-04-09 22:36:40 +02:00
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $property;
2024-04-09 22:36:40 +02:00
/**
* Create a new job instance.
*/
public function __construct($property)
2024-04-09 22:36:40 +02:00
{
$this->property = $property;
2024-04-09 22:36:40 +02:00
}
/**
* Execute the job.
*/
public function handle(): void
2024-04-13 16:11:18 +02:00
{
Edomizil::scrapePropertyData($this->property);
2024-04-13 16:11:18 +02:00
sleep(random_int(1,20));
2024-04-09 22:36:40 +02:00
}
}