notificationPreferenceFor($this->project); $channels = []; if ($pref->database_enabled) { $channels[] = 'database'; } if ($pref->email_enabled) { $channels[] = 'mail'; } return $channels; } public function toMail(object $notifiable): MailMessage { $url = route('projects.issues.show', [$this->project, $this->issue]); return (new MailMessage) ->subject("[{$this->project->name}] Regression: {$this->issue->title}") ->greeting("Issue regressed in {$this->project->name}") ->line("A previously resolved issue has reappeared:") ->line($this->issue->title) ->action('View Issue', $url) ->line("Total occurrences: {$this->issue->times_seen}"); } public function toArray(object $notifiable): array { return [ 'type' => 'regression', 'project_id' => $this->project->id, 'project_name' => $this->project->name, 'issue_id' => $this->issue->id, 'issue_title' => $this->issue->title, 'level' => $this->issue->level, ]; } }