data = $data; } public function via($notifiable) { return sysConfig('node_offline_notification'); } public function toMail($notifiable): MailMessage { return (new MailMessage) ->subject(trans('notification.node_offline')) ->markdown('mail.simpleMarkdown', ['title' => trans('notification.node_offline_content'), 'content' => $this->markdownMessage(), 'url' => route('admin.node.index')]); } private function markdownMessage(): string { $content = ''; foreach ($this->data as $node) { $content .= "- {$node['name']} {$node['host']}".PHP_EOL; } return $content; } public function toCustom($notifiable): array { return [ 'title' => trans('notification.node_offline'), 'content' => $this->markdownMessage(), 'url_type' => 'markdown', ]; } public function toBark($notifiable): array { return [ 'title' => trans('notification.node_offline'), 'content' => $this->stringMessage(), 'group' => trans('common.bark.node_status'), 'icon' => asset('assets/images/notification/offline.png'), ]; } private function stringMessage(): string { $content = ''; foreach ($this->data as $node) { $content .= "{$node['name']} {$node['host']}| "; } return $content; } public function toTelegram($notifiable): TelegramMessage { return TelegramMessage::create() ->token(sysConfig('telegram_token')) ->content($this->markdownMessage()); } }