ifnex/04_Laravel/app/Notifications/OrderNeedsChangesNotification.php

40 lines
1.1 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\Shipment;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
/**
* اعلان به مشتری: سفارش شما نیازمند اصلاح است.
* (Trigger: ShipmentReviewService::requestChanges)
*/
class OrderNeedsChangesNotification extends Notification
{
use Queueable;
public function __construct(
public Shipment $shipment,
public string $reason,
public ?string $notes = null,
) {}
public function via($notifiable): array
{
return ['database'];
}
public function toArray($notifiable): array
{
return [
'type' => 'order_needs_changes',
'shipment_id' => $this->shipment->id,
'awb_no' => $this->shipment->awb_no,
'reason' => $this->reason,
'notes' => $this->notes,
'message' => "سفارش {$this->shipment->awb_no} نیازمند اصلاح است: {$this->reason}",
'action_url' => '/order-detail/?order_id=' . $this->shipment->id,
];
}
}