In case, you want to keep everything as simple, you can use Laravel built-in feature. It is email verification. I do not guarantee this way would resolve your problem. It is reference in case you didn't know about it before.
Follow the doc at https://laravel.com/docs/7.x/verification, all you have to do are a few steps.
- Implementation of the
User
model withMustVerifyEmail
<?phpnamespace App;use Illuminate\Contracts\Auth\MustVerifyEmail;use Illuminate\Foundation\Auth\User as Authenticatable;use Illuminate\Notifications\Notifiable;class User extends Authenticatable implements MustVerifyEmail{ use Notifiable; // ...}
Active the middleware
verify
for the routes inweb.php
or in controllerYou can activate the verification link and verify email
Auth::routes(['verify' => true]);
- Make sure the user migration has included
email_verified_at
column.
I often use this built-in feature if I need verification users before allowing it to access the application.