-
backend/app/Events/OrderStatusChangedEvent.php
Open in GitHubuse HiEvents\DomainObjects\OrderDomainObject; use Illuminate\Foundation\Events\Dispatchable; class OrderStatusChangedEvent { use Dispatchable; public function __construct( public OrderDomainObject $order, public bool $sendEmails = true, ) { } }
-
backend/app/Listeners/Order/SendOrderDetailsEmailListener.php
Open in GitHubuse HiEvents\Events\OrderStatusChangedEvent; use HiEvents\Jobs\Order\SendOrderDetailsEmailJob; readonly class SendOrderDetailsEmailListener { public function handle(OrderStatusChangedEvent $changedEvent): void { if (!$changedEvent->sendEmails) { return; } dispatch(new SendOrderDetailsEmailJob($changedEvent->order)); } }
-
backend/app/Services/Handlers/Order/CompleteOrderHandler.php
Open in GitHubuse HiEvents\DomainObjects\OrderDomainObject; use HiEvents\Events\OrderStatusChangedEvent; use HiEvents\Services\Handlers\Order\DTO\CompleteOrderDTO; readonly class CompleteOrderHandler { // ... public function handle(string $orderShortId, CompleteOrderDTO $orderData): OrderDomainObject { return DB::transaction(function () use ($orderData, $orderShortId) { // ... OrderStatusChangedEvent::dispatch($updatedOrder); return $updatedOrder; }); } // ... }