/** * @param Warning $warning */ public function notify(Warning $warning) { $url = $this->settings->webhook_url; $payload = ['username' => 'CronMonitor', 'text' => $warning->getTitle() . " <" . route('account.monitors.index') . "|View my monitors>"]; $client = new Client(); $client->post($url, ['json' => $payload]); }
/** * @param Warning $warning */ public function notify(Warning $warning) { $url = $this->settings->webhook_url; $payload = ['color' => 'red', 'message_format' => 'html', 'message' => $warning->getTitle() . ' <a href="' . route('account.monitors.index') . '">View my monitors</a>']; $client = new Client(); $client->post($url, ['json' => $payload]); }
/** * Execute the console command. * * @return mixed */ public function handle() { $warnings = Warning::getUnsent(); $this->info("Found " . count($warnings) . " unsent warnings"); /** @var Warning $warning */ foreach ($warnings as $warning) { $warning->monitor->notify($warning); $warning->sent_at = new Carbon(); $warning->save(); } }
/** * Notify user by Email about failed monitor task * * @param Warning $warning */ public function notify(Warning $warning) { \Mail::send('emails.notify', ['title' => $warning->getTitle(), 'text' => $warning->getMessage()], function (Message $message) use($warning) { $message->to($this->settings->email)->subject("[{$warning->monitor->name}] Warning, task has failed!"); }); }
/** * @param Warning $warning */ public function notify(Warning $warning) { $recipient = $this->settings->recipient; $this->twilioService->sendSMS($recipient, $warning->getTitle()); }