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

39 lines
1.1 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\Shipment;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
/**
* اعلان به مشتری: سفارش شما تأیید شد، اکنون می‌توانید پرداخت کنید.
* (Trigger: ShipmentReviewService::approve)
*/
class OrderApprovedForPaymentNotification extends Notification
{
use Queueable;
public function __construct(
public Shipment $shipment,
public ?User $approvedBy = null,
) {}
public function via($notifiable): array
{
return ['database'];
}
public function toArray($notifiable): array
{
return [
'type' => 'order_approved',
'shipment_id' => $this->shipment->id,
'awb_no' => $this->shipment->awb_no,
'total_fee' => $this->shipment->total_fee,
'message' => "سفارش {$this->shipment->awb_no} تأیید شد. اکنون می‌توانید پرداخت کنید.",
'action_url' => '/order-detail/?order_id=' . $this->shipment->id,
];
}
}