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