*/ public function via(object $notifiable): array { return ['mail']; } /** * Get the mail representation of the notification. */ public function toMail(object $notifiable): MailMessage { $locale = $notifiable->preferred_language ?? 'ar'; return (new MailMessage) ->subject($this->getSubject($locale)) ->view('emails.timeline-update', [ 'timelineUpdate' => $this->timelineUpdate, 'timeline' => $this->timelineUpdate->timeline, 'locale' => $locale, 'user' => $notifiable, ]); } /** * Get the subject based on locale. */ private function getSubject(string $locale): string { return $locale === 'ar' ? 'تحديث جديد على قضيتك' : 'New Update on Your Case'; } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { return [ 'type' => 'timeline_update', 'timeline_update_id' => $this->timelineUpdate->id, 'timeline_id' => $this->timelineUpdate->timeline_id, ]; } }