<?php namespace Bixo\Shop\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; use Bixo\Shop\Events\SparePartAction as SparePartActionEvent; use Bixo\Shop\Models\SparePart; class SparePartAction extends Notification implements ShouldQueue { use Queueable; protected $event; protected $spare_part; protected $action; protected $request; /** * Create a new notification instance. * * @param SparePartActionEvent $spare_part */ public function __construct(SparePartActionEvent $spare_part) { $this->action = $event->action; $this->spare_part = $spare_part; $this->request = $event->request; $this->event = $event; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { return (new MailMessage) ->subject('SparePart Approved - ' . config('app.name')) ->view('shop::spare_part.email.action', ['data' => $this->spare_part]); } /** * Get the notification's delivery channels. * * @param object $notifiable * @return array<int, string> */ public function via(object $notifiable): array { return ['mail']; } }