diff --git a/app/Models/User.php b/app/Models/User.php index 248fd04..224e5b5 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,6 +2,8 @@ namespace App\Models; +use App\Notifications\ResetPassword; +use App\Notifications\VerifyEmail; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -76,6 +78,22 @@ class User extends Authenticatable implements MustVerifyEmail return Str::lower($this->role?->name) === 'administrator'; } + /** + * Overwritten to instead use the queued version of the VerifyEmail notification. + */ + public function sendEmailVerificationNotification(): void + { + $this->notify(new VerifyEmail); + } + + /** + * Overwritten to instead use the queued version of the ResetPassword notification. + */ + public function sendPasswordResetNotification(#[\SensitiveParameter] $token): void + { + $this->notify(new ResetPassword($token)); + } + protected function casts(): array { return [ diff --git a/app/Notifications/ResetPassword.php b/app/Notifications/ResetPassword.php new file mode 100644 index 0000000..85c4838 --- /dev/null +++ b/app/Notifications/ResetPassword.php @@ -0,0 +1,25 @@ +