ldc-crm/app/Jobs/StartStatJobs.php

25 lines
529 B
PHP

<?php
namespace App\Jobs;
use App\Models\Brand;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
class StartStatJobs implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
public function handle()
{
$brands = Brand::all();
foreach ($brands as $brand) {
\dispatch(new StatJob($brand))
->delay(rand(0, 90));
}
}
}