app/Jobs/ShortJob.php
<?php
namespace App\Jobs;
use Illuminate\Bus\Batchable;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Moox\Jobs\Traits\JobProgress;
class ShortJob implements ShouldQueue
{
use Batchable, Dispatchable, InteractsWithQueue, JobProgress, Queueable, SerializesModels;
public $tries;
public $timeout;
public $maxExceptions;
public $backoff;
public function __construct()
{
$this->tries = 10;
$this->timeout = 10;
$this->maxExceptions = 3;
$this->backoff = 20;
}
public function handle()
{
if ($this->batch()->cancelled()) {
return;
}
$count = 0;
$steps = 10;
$final = 100;
while ($count < $final) {
$this->setProgress($count);
$count = $count + $steps;
}
}
}