]> BookStack Code Mirror - bookstack/blob - app/Notifications/UserInvite.php
Notifications: Switched testing from string to reference levels
[bookstack] / app / Notifications / UserInvite.php
1 <?php
2
3 namespace BookStack\Notifications;
4
5 use BookStack\Users\Models\User;
6 use Illuminate\Notifications\Messages\MailMessage;
7
8 class UserInvite extends MailNotification
9 {
10     public $token;
11
12     /**
13      * Create a new notification instance.
14      */
15     public function __construct(string $token)
16     {
17         $this->token = $token;
18     }
19
20     /**
21      * Get the mail representation of the notification.
22      */
23     public function toMail(User $notifiable): MailMessage
24     {
25         $appName = ['appName' => setting('app-name')];
26         $language = setting()->getUser($notifiable, 'language');
27
28         return $this->newMailMessage()
29                 ->subject(trans('auth.user_invite_email_subject', $appName, $language))
30                 ->greeting(trans('auth.user_invite_email_greeting', $appName, $language))
31                 ->line(trans('auth.user_invite_email_text', [], $language))
32                 ->action(trans('auth.user_invite_email_action', [], $language), url('/register/invite/' . $this->token));
33     }
34 }