-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use email notifications instead of mailables
- Loading branch information
Showing
7 changed files
with
104 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace App\Notifications; | ||
|
||
use App\Models\User; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
use Illuminate\Notifications\Notification; | ||
|
||
class UserRegistered extends Notification | ||
{ | ||
use Queueable; | ||
|
||
public function __construct(public readonly User $user) | ||
{ | ||
} | ||
|
||
/** | ||
* Get the notification's delivery channels. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function via($notifiable) | ||
{ | ||
return ['mail']; | ||
} | ||
|
||
/** | ||
* Get the mail representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toMail($notifiable) | ||
{ | ||
return (new MailMessage) | ||
->subject(__('New user registered: :name', [ | ||
'name' => $this->user->name, | ||
])) | ||
->greeting(__('User registered')) | ||
->line(__('The user :name (:email) has created a new account.', [ | ||
'name' => $this->user->name, | ||
'email' => $this->user->email, | ||
])) | ||
->action(__('View User'), route('users.show', $this->user)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace App\Notifications; | ||
|
||
use App\Models\User; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
use Illuminate\Notifications\Notification; | ||
|
||
class UserRegisteredConfirmation extends Notification | ||
{ | ||
use Queueable; | ||
|
||
public function __construct(public readonly User $user) | ||
{ | ||
} | ||
|
||
/** | ||
* Get the notification's delivery channels. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function via($notifiable) | ||
{ | ||
return ['mail']; | ||
} | ||
|
||
/** | ||
* Get the mail representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toMail($notifiable) | ||
{ | ||
return (new MailMessage) | ||
->subject(__('New user account registered at :app_name', [ | ||
'app_name' => config('app.name'), | ||
])) | ||
->greeting(__('Registration confirmation')) | ||
->line(__('Dear :name.', [ | ||
'name' => $this->user->name, | ||
])) | ||
->line(__('Thanks for registering an account at :app_name with your e-mail address :email.', [ | ||
'app_name' => config('app.name'), | ||
'email' => $this->user->email, | ||
])) | ||
->action(__('View your profile'), route('userprofile')); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
resources/views/emails/users/registered_confirmation.blade.php
This file was deleted.
Oops, something went wrong.