@param NotifiableInterface $notifiable

@return int
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Doctrine\ORM\NonUniqueResultException
@throws \Doctrine\ORM\NoResultException
7519
public function getNotificationCount(NotifiableInterface $notifiable)
    {
        return $this->notifiableNotificationRepository->getNotificationCount(
            $this->generateIdentifier($notifiable),
            ClassUtils::getRealClass(get_class($notifiable))
        );
    }
819813
public function toMail($notifiable)
    {
        $frontendReferer = parse_url(request()->headers->get('referer'));
        $frontendURL = $frontendReferer['scheme'] . '://' . $frontendReferer['host'];
        if ($frontendReferer['port']) {
            $frontendURL .= (':' . $frontendReferer['port']);
        }
        $frontendURL .= $frontendReferer['path'];
        $email = request()->get('email');
        $resetUrl = $frontendURL . '#/password/reset?email=' . $email . '&reset_token=' . $this->token;
        return (new MailMessage)
            ->line('You are receiving this email because we received a password reset request for your account.')
            ->action('Reset Password', $resetUrl)
            ->line('If you did not request a password reset, no further action is required.');
    }
1022902
public function toMail($notifiable)
    {
        $content = 'A log on ' . url('/') . ' has been written to.';
        if($notifiable->filter !== '*') {
            $content .= " You're being notified because the log contains `" . $notifiable->filter . "`";
        }

        $status = 'success';
        foreach($this->notificationLevels as $triggerLevel => $childLevels) {
            if(in_array($this->requestInfo['level'], $childLevels)) {
                $status = $triggerLevel;
            }
        }

        $fields = array(
            'Level' => $this->requestInfo['level'],
            'Message' => $this->requestInfo['message']
        );

        if($this->requestInfo['user_id']) {
            $fields['User ID'] = $this->requestInfo['user_id'];
        }

        if($this->requestInfo['email']) {
            $fields['Associated Email'] = $this->requestInfo['email'];
        }

        $statusColors = array(
            'success' => '#00B945',
            'warning' => '#ff9f00',
            'error' => '#BC001A'
        );

        return (new MailMessage)
            ->subject(env('LARAMETRICS_LOG_SUBJECT', '[Larametrics Alert] The application log has been written to'))
            ->from(env('LARAMETRICS_FROM_EMAIL', 'alerts@larametrics.com'), env('LARAMETRICS_FROM_NAME', 'Larametrics Alerts'))
            ->view('larametrics::emails.log-written', [
                'requestInfo' => $this->requestInfo,
                'content' => $content,
                'alertColor' => $statusColors[$status]
            ]);
    }
315930
public function toMail($notifiable)
    {
        return (new MailMessage())
                    ->subject(trans('notifications.user.invite.mail.subject'))
                    ->greeting(trans('notifications.user.invite.mail.title', ['app_name' => Config::get('setting.app_name')]))
                    ->action(trans('notifications.user.invite.mail.action'), cachet_route('signup.invite', [$notifiable->code]))
                    ->line(trans('notifications.user.invite.mail.content', ['app_name' => Config::get('setting.app_name')]));
    }
708707
public function send(NotifiableInterface $notifiable, Notification $notification)
    {
        /**
         * @var $message CloudPushMessage
         */
        $message = $notification->toCloudPush();
        $appRecipient = $notifiable->routeNotificationFor('cloudPush');
        if ($message->validate()) {
            $messageParams = [
                'AppKey' => $this->appKey,
                'Target' => $appRecipient['target'],
                'TargetValue' => $appRecipient['targetValue'],
                'Title' => $message->title,
                'Body' => $message->content,
            ];
            if (!empty($message->extParameters)) {
                $messageParams['ExtParameters'] = Json::encode($message->extParameters);
            }
            $this->aliyun->getCloudPush()->pushNoticeToAndroid($messageParams);
            $messageParams['ApnsEnv'] = YII_ENV_DEV ? 'DEV' : 'PRODUCT';
            $this->aliyun->getCloudPush()->pushNoticeToIOS($messageParams);
        } else {
            print_r($message->getErrors());
            exit;
        }
    }
1346228
public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject($this->subject)
            ->view($this->view, [
                'name' => $notifiable->fullName,
                'route' => $this->route($notifiable),
            ]);
    }
828702
public function send($notifiable, Notification $notification)
    {
        if (! $notifiable->routeNotificationFor('mail')) {
            return;
        }

        $mail = $notification->toMail($notifiable);

        $this->mailer->send($mail->view, $mail->data(), function ($message) use ($notifiable, $notification, $mail)
        {
            $recipients = empty($mail->to) ? $notifiable->routeNotificationFor('mail') : $mail->to;

            if (! empty($mail->from)) {
                $message->from($mail->from[0], isset($mail->from[1]) ? $mail->from[1] : null);
            }

            if (is_array($recipients)) {
                $message->bcc($recipients);
            } else {
                $message->to($recipients);
            }

            if (! empty($mail->cc)) {
                $message->cc($mail->cc);
            }

            if (! empty($mail->replyTo)) {
                $message->replyTo($mail->replyTo[0], isset($mail->replyTo[1]) ? $mail->replyTo[1] : null);
            }

            $message->subject($mail->subject ?: Str::title(
                Str::snake(class_basename($notification), ' ')
            ));

            foreach ($mail->attachments as $attachment) {
                $message->attach($attachment['file'], $attachment['options']);
            }

            foreach ($mail->rawAttachments as $attachment) {
                $message->attachData($attachment['data'], $attachment['name'], $attachment['options']);
            }

            if (! is_null($mail->priority)) {
                $message->setPriority($mail->priority);
            }
        });
    }
197818
public function toMail($notifiable)
    {
        $mailMessage = (new MailMessage)
            ->error()
            ->subject($this->getMessageText())
            ->line($this->getMessageText());

        foreach ($this->getMonitorProperties() as $name => $value) {
            $mailMessage->line($name.': '.$value);
        }

        return $mailMessage;
    }
501938
protected function getData($notifiable, Notification $notification)
    {
        if (method_exists($notification, 'toBroadcast')) {
            return $notification->toBroadcast($notifiable);
        }

        if (method_exists($notification, 'toArray')) {
            return $notification->toArray($notifiable);
        }

        throw new RuntimeException('Notification is missing toArray method.');
    }
800580
public function generateIdentifier(NotifiableInterface $notifiable)
    {
        $Notifiableidentifiers = $this->getNotifiableIdentifier($notifiable);
        $identifierValues = array();
        foreach ($Notifiableidentifiers as $identifier) {
            $method = sprintf('get%s', ucfirst($identifier));
            $identifierValues[] = $notifiable->$method();
        }

        return implode('-', $identifierValues);
    }
926322
protected function pushNotification($notification, $notifiable)
    {
        if ($notifiable instanceof NotifiableGroup) {
            foreach ($notifiable->getGroup() as $toBeNotified) {
                $this->push($notification, $toBeNotified);
            }
        } else {
            // @todo Change this fucking shite
            $notification = $notifiable->notifications()->create($notification);

            event(new NotificationAdded($notification, $notifiable));
        }
    }
159089
public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject(trans('authentication-log::messages.subject'))
            ->markdown('authentication-log::emails.new', [
                'account' => $notifiable,
                'time' => $this->authenticationLog->login_at,
                'ipAddress' => $this->authenticationLog->ip_address,
                'browser' => $this->authenticationLog->user_agent,
            ]);
    }
959829
public function toMail($notifiable)
    {
        $content = trans('notifications.incident.update.mail.content', [
            'name'    => $this->update->incident->name,
            'time'    => $this->update->created_at_diff,
        ]);

        return (new MailMessage())
            ->subject(trans('notifications.incident.update.mail.subject'))
            ->markdown('notifications.incident.update', [
                'incident'               => $this->update->incident,
                'update'                 => $this->update,
                'content'                => $content,
                'actionText'             => trans('notifications.incident.new.mail.action'),
                'actionUrl'              => cachet_route('incident', [$this->update->incident]),
                'incidentName'           => $this->update->incident->name,
                'newStatus'              => $this->update->human_status,
                'unsubscribeText'        => trans('cachet.subscriber.unsubscribe'),
                'unsubscribeUrl'         => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
                'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
                'manageSubscriptionUrl'  => cachet_route('subscribe.manage', $notifiable->verify_code),
        ]);
    }
60216
public function send($notifiable, $item)
    {
        return (new MailMessage())
            ->line($this->getMessage($item))
            ->from(
                config('tddd.notifications.from.address'),
                config('tddd.notifications.from.name')
            )
            ->action($this->getActionTitle(), $this->getActionLink());
    }
571202
protected function getTo($notifiable)
    {
        if ($notifiable->routeNotificationFor('twilio')) {
            return $notifiable->routeNotificationFor('twilio');
        }
        if (isset($notifiable->phone_number)) {
            return $notifiable->phone_number;
        }

        throw CouldNotSendNotification::invalidReceiver();
    }
450525
public function toMail($notifiable)
    {
        $email = $notifiable->getEmailForEmailVerification();
        $link = route('verifyEmailLink', ['email' => $email, 'expiration' => $this->expiration, 'token' => $this->token]);
        return (new MailMessage)
            ->subject(trans('emailverification::messages.resend.title'))
            ->line(trans('emailverification::messages.email.welcome'))
            ->line(trans('emailverification::messages.email.instructions'))
            ->action(trans('emailverification::messages.email.action'), $link);
    }
39595
public function toMail($notifiable)
    {
        return (new MailMessage)
            ->line('Hey '.$notifiable->name)
            ->line('We have a notfiication for you.')
            ->line($this->info['title'])
            ->line($this->info['details'])
            ->action('Visit here for more info', url('/user/notifications'));
    }