| 
									
										
										
										
											2021-06-26 23:23:15 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace BookStack\Notifications; | 
					
						
							| 
									
										
										
										
											2019-08-17 22:52:33 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-18 00:56:55 +08:00
										 |  |  | use BookStack\Users\Models\User; | 
					
						
							| 
									
										
										
										
											2022-02-01 06:15:21 +08:00
										 |  |  | use Illuminate\Notifications\Messages\MailMessage; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-17 22:52:33 +08:00
										 |  |  | class UserInvite extends MailNotification | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     public $token; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Create a new notification instance. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2022-02-01 06:15:21 +08:00
										 |  |  |     public function __construct(string $token) | 
					
						
							| 
									
										
										
										
											2019-08-17 22:52:33 +08:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->token = $token; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get the mail representation of the notification. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2022-02-01 06:15:21 +08:00
										 |  |  |     public function toMail(User $notifiable): MailMessage | 
					
						
							| 
									
										
										
										
											2019-08-17 22:52:33 +08:00
										 |  |  |     { | 
					
						
							|  |  |  |         $appName = ['appName' => setting('app-name')]; | 
					
						
							| 
									
										
										
										
											2022-02-01 06:15:21 +08:00
										 |  |  |         $language = setting()->getUser($notifiable, 'language'); | 
					
						
							| 
									
										
										
										
											2021-06-26 23:23:15 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-17 22:52:33 +08:00
										 |  |  |         return $this->newMailMessage() | 
					
						
							| 
									
										
										
										
											2022-02-01 06:15:21 +08:00
										 |  |  |                 ->subject(trans('auth.user_invite_email_subject', $appName, $language)) | 
					
						
							|  |  |  |                 ->greeting(trans('auth.user_invite_email_greeting', $appName, $language)) | 
					
						
							|  |  |  |                 ->line(trans('auth.user_invite_email_text', [], $language)) | 
					
						
							|  |  |  |                 ->action(trans('auth.user_invite_email_action', [], $language), url('/register/invite/' . $this->token)); | 
					
						
							| 
									
										
										
										
											2019-08-17 22:52:33 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | } |