Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

murilo's avatar
Level 10

laravel 11 breeze , with blade . add middleware auth and verified

hello , I created a laravel 11 project . I added laravel breeze with blade to laravel . it created the login page , and authenticated . but when I am redirected to the dashboard I am sending back to the login page .

I checked this method , it is ok -

  public function authenticate(): void
    {
        $this->ensureIsNotRateLimited();
        if (! Auth::guard('web')->attempt($this->only('email', 'password'), $this->boolean('remember'))) {
       
    }


if I give a dd there , I will see that is attempting the login correctly with the user and password . ok , now goes to the next step .

that is to redirect to the dashboard -

return redirect()->intended(route('dashboard', absolute: false));

and in the route is restricting like that , with the middleware -

Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');

I had a look , and it does not have inside the /bootstrap/app.php those middlewares . breeze didnt created to me . do I have to create that ?

my middleware is empty _

   ->withMiddleware(function (Middleware $middleware) {
        $middleware->alias([
            ]);
    })
0 likes
7 replies
gych's avatar
gych
Best Answer
Level 29

You don't need to add the middlewares in app.php

Try to remove the verified middleware and test if it works.

Snapey's avatar

auth middleware checks that the user is logged in before accessing the dashboard

verified middleware checks that the user has verified their email address before accessing the dashboard.

Verifying the email address is optional.

1 like
arf-01's avatar

@Snapey i am a begineer . in laravel breeze i am not getting any middleware file why??

gambino's avatar

@arf-01 Middleware file is located in app/Http/Middleware, if you are asking about the internal middleware like auth and guest they are located at vendor/laravel/framework/src/Illuminate/Auth/Middleware

Snapey's avatar

@Passioncorners they are in the vendor directory in 11. Previous versions there was a middleware folder in app.

Please or to participate in this conversation.