File: /var/www/ipsremont-demo/app/Jobs/ErrorReportJob.php
<?php
namespace App\Jobs;
use App\Exceptions\ErrorReportException;
use App\Helpers\ErrorReportHelper;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Throwable;
class ErrorReportJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private string $message;
public function __construct(string $message)
{
$this->message = $message;
}
public function handle()
{
try {
ErrorReportHelper::send($this->message);
} catch (Throwable $exception) {
throw new ErrorReportException($exception->getMessage());
}
}
}