Skip to content

Commit

Permalink
Send EmailVerified email notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Dec 11, 2021
1 parent 3ddd868 commit a9b7f77
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Containers\AppSection\Authentication\Actions;

use App\Containers\AppSection\Authentication\Notifications\EmailVerified;
use App\Containers\AppSection\Authentication\UI\API\Requests\VerifyEmailRequest;
use App\Ship\Parents\Actions\Action;
use Illuminate\Auth\Events\Verified;

class VerifyEmailAction extends Action
{
Expand All @@ -13,7 +13,7 @@ public function run(VerifyEmailRequest $request): void
if (!$request->user()->hasVerifiedEmail()) {
$request->user()->markEmailAsVerified();

event(new Verified($request->user()));
$request->user()->notify(new EmailVerified());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Containers\AppSection\Authentication\Notifications;

use App\Ship\Parents\Models\UserModel;
use App\Ship\Parents\Notifications\Notification;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class EmailVerified extends Notification implements ShouldQueue
{
use Queueable;

public function via($notifiable): array
{
return ['mail'];
}

public function toMail(UserModel $notifiable): MailMessage
{
return (new MailMessage())
->subject('Email Verified')
->line('Your email has been verified.');
}
}

0 comments on commit a9b7f77

Please sign in to comment.