Support the ongoing development of Laravel.io →
Authentication Security Requests
Last updated 1 month ago.
0

I guess you could add a condition to your middleware to check for that.

public function handle($request, Closure $next)
{
       if ($this->auth->check() or $request->is("auth/login"))
       {
                return $next($request);
       } else
       {
                return redirect()->guest('auth/login');
       }
}
Last updated 7 years ago.
0

I had the exact same question and I came with the same 2 answers. But I believe the "plan B" is better. Don't touch the AuthController and instead group all the routes that need the middleware together, and just put your couple of auth routes that don't take the middleware on the top. Clean and clear.

0

Sign in to participate in this thread!

Cloudways

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.