Support the ongoing development of Laravel.io →
posted 7 years ago
Session
Last updated 1 year ago.
0

you just set redirection in Auth Controller protected $redirectTo = '/home'; Auth middleware return redirect()->guest('login');

0

Thanks

public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->guest()) { if ($request->ajax() || $request->wantsJson()) { return response('Unauthorized.', 401); } else { return redirect()->guest('signin'); } }

    return $next($request);
}

this is my new code i think this working now

0

Sign in to participate in this thread!

Eventy

Your banner here too?

mares992 mares992 Joined 15 Sep 2016

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.