Пример #1
0
 /**
  * @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]);
 }
Пример #2
0
 /**
  * @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]);
 }
Пример #3
0
 /**
  * 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();
     }
 }
Пример #4
0
 /**
  * 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!");
     });
 }
Пример #5
0
 /**
  * @param Warning $warning
  */
 public function notify(Warning $warning)
 {
     $recipient = $this->settings->recipient;
     $this->twilioService->sendSMS($recipient, $warning->getTitle());
 }