| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Jobs;
- use App\Events\SendWebSocketMessageEvent;
- use App\Services\ExportMafRegistryService;
- use Exception;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Queue\Queueable;
- use Illuminate\Support\Facades\Log;
- class ExportMafRegistryJob implements ShouldQueue
- {
- use Queueable;
- public function __construct(
- private readonly int $userId,
- private readonly string $updNumber,
- private readonly int $year,
- ) {
- }
- public function handle(): void
- {
- try {
- $link = (new ExportMafRegistryService())->handle($this->userId, $this->updNumber, $this->year);
- Log::info('ExportMafRegistry job done!');
- event(new SendWebSocketMessageEvent('Реестр на оплату сформирован!', $this->userId, ['success' => true, 'link' => $link]));
- } catch (Exception $e) {
- Log::error('ExportMafRegistry job failed! ' . $e->getMessage());
- event(new SendWebSocketMessageEvent('Ошибка формирования реестра на оплату! ', $this->userId, ['error' => $e->getMessage()]));
- }
- }
- }
|