diff --git a/app/Notifications/OrderDelivered.php b/app/Notifications/OrderDelivered.php index 9d231ff..ef6c107 100644 --- a/app/Notifications/OrderDelivered.php +++ b/app/Notifications/OrderDelivered.php @@ -2,6 +2,7 @@ namespace App\Notifications; +use App\Models\Order; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; @@ -11,12 +12,14 @@ class OrderDelivered extends Notification { use Queueable; + private Order $order; + /** * Create a new notification instance. */ - public function __construct() + public function __construct(Order $order) { - // + $this->order = $order; } /** @@ -35,9 +38,10 @@ public function via(object $notifiable): array public function toMail(object $notifiable): MailMessage { return (new MailMessage) - ->line('The introduction to the notification.') - ->action('Notification Action', url('/')) - ->line('Thank you for using our application!'); + ->greeting('Hello ' . $this->order->user->name . '!') + ->line('Your order has been delivered successfully.') + ->action('View Order', route('orders.show', $this->order)) + ->line('Thank you for using our application!'); } /**