<?php namespace Bixo\Car\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; use Bixo\Car\Events\CarAction as CarActionEvent; use Bixo\Car\Models\Car; class CarAction extends Notification implements ShouldQueue { use Queueable; protected $event; protected $car; protected $action; protected $request; /** * Create a new notification instance. * * @param CarActionEvent $car */ public function __construct(CarActionEvent $car) { $this->action = $event->action; $this->car = $car; $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('Car Approved - ' . config('app.name')) ->view('car::car.email.action', ['data' => $this->car]); } /** * Get the notification's delivery channels. * * @param object $notifiable * @return array<int, string> */ public function via(object $notifiable): array { return ['mail']; } }