When adding ->middleware(['auth', 'verified']) to a route, the verified middleware doesn't apply.
laravel new blogphp artisan make:auth.env filephp artisan migratephp artisan tinker then:\App\User::create([
'name' => 'Test User',
'email' => '[email protected]',
'password' => bcrypt('secret'),
]);
$this->middleware(['auth', 'verified']); to the HomeController constructorIt's normal that your login view is still shown as this is controlled by the LoginController and not the HomeController. You're sure you're not mixing up the "welcome" view and "home" view?
It's definitely not the welcome view. It's specifically the resources/views/home.blade.php view, the one that says "You are logged in!" and is presented in the HomeController index method, the same controller that has both those middleware attached.
Can you post your User model?
Since this is a fresh install it's the default:
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
Are you able to reproduce the issue? It should only take 30 seconds.
You need to implement the MustVerifyEmail interface: https://laravel.com/docs/5.7/verification#introduction
That should do it.
Oops, sorry for wasting your time.
@ryanmortier infact you didn't waste our tym, very many people forget this
Most helpful comment
@ryanmortier infact you didn't waste our tym, very many people forget this