ExportCommonCatalogJob.php 710 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Jobs\Export;
  4. use App\Events\SendWebSocketMessageEvent;
  5. use App\Services\Export\ExportCommonCatalogService;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Foundation\Queue\Queueable;
  8. class ExportCommonCatalogJob implements ShouldQueue
  9. {
  10. use Queueable;
  11. public function __construct(private readonly int $userId) {}
  12. public function handle(ExportCommonCatalogService $service): void
  13. {
  14. $link = $service->handle($this->userId);
  15. event(new SendWebSocketMessageEvent(
  16. 'Экспорт общего каталога завершён!',
  17. $this->userId,
  18. ['link' => $link],
  19. ));
  20. }
  21. }