title = $title; $this->content = $content; $this->send_mail = $send_mail; } /** * Get the notification's delivery channels. * * @return array */ public function via(): array { $channels = [WebChannel::class]; if ($this->send_mail) { $channels[] = 'mail'; } return $channels; } /** * Get the mail representation of the notification. * * @return MailMessage */ public function toMail(): MailMessage { return (new MailMessage)->subject($this->title)->markdown('mail.common', [ 'title' => $this->title, 'content' => $this->content, ]); } /** * Get the array representation of the notification. * * @return array */ public function toArray(): array { return [ 'title' => $this->title, 'content' => $this->content, 'event' => 'notifications', ]; } }