$itemIds */ public function __construct( private readonly string $type, private readonly int $orderId, private readonly int $userId, private readonly ?int $relatedId = null, private readonly array $itemIds = [], ) {} public function handle(ProductionOrderDocumentService $service): void { try { $file = $service->generate( $this->type, $this->orderId, $this->userId, $this->relatedId, $this->itemIds, ); event(new SendWebSocketMessageEvent( 'Файл по заказу готов!', $this->userId, ['link' => $file->link], )); } catch (Throwable $exception) { Log::error('Production order file generation failed.', [ 'type' => $this->type, 'order_id' => $this->orderId, 'user_id' => $this->userId, 'error' => $exception->getMessage(), ]); event(new SendWebSocketMessageEvent( 'Ошибка формирования файла: '.$exception->getMessage(), $this->userId, ['error' => $exception->getMessage()], )); throw $exception; } } }