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}] Spike: {$this->eventCount} events in {$this->windowMinutes}m") ->greeting("Event spike in {$this->project->name}") ->line("{$this->eventCount} events received in the last {$this->windowMinutes} minutes for:") ->line($this->issue->title) ->action('View Issue', $url); } public function toArray(object $notifiable): array { return [ 'type' => 'spike', 'project_id' => $this->project->id, 'project_name' => $this->project->name, 'issue_id' => $this->issue->id, 'issue_title' => $this->issue->title, 'event_count' => $this->eventCount, 'window_minutes' => $this->windowMinutes, ]; } }