So I used this preset for the authentication for my laravel app and it is sending me verification emails but I want to redirect them to a certain page telling them to verify their emails first before logging in but instead, it will automatically log them into my app without them verifying their email.
This is my code Homecontroller
public function __construct()
{
$this->middleware(['auth','verified']);
}
web.php
Auth::routes(['verify' => true]);
then my user model is this
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable implements MustVerifyEmail
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
I watch tutorials similar to mine and it works on them with the changes above but on my end it seems it's not working, it will directly go to my dashboard.
This is my database migration
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});