user = $user; $this->count = $count; } /** * Get the array representation of the notification. * * @param mixed $notifiable * * @return array * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { return [ ]; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * * @return MailMessage * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { $subject = (string)trans('email.mfa_many_failed_subject', ['count' => $this->count]); return (new MailMessage())->markdown('emails.security.many-failed-attempts', ['user' => $this->user, 'count' => $this->count])->subject($subject); } /** * Get the Slack representation of the notification. * * @param mixed $notifiable * * @return SlackMessage * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toSlack($notifiable) { $message = (string)trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]); return (new SlackMessage())->content($message); } /** * Get the notification's delivery channels. * * @param mixed $notifiable * * @return array * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { /** @var null|User $user */ $user = auth()->user(); $slackUrl = null === $user ? '' : app('preferences')->getForUser(auth()->user(), 'slack_webhook_url', '')->data; if (is_array($slackUrl)) { $slackUrl = ''; } if (UrlValidator::isValidWebhookURL((string)$slackUrl)) { return ['mail', 'slack']; } return ['mail']; } }