dimanche 1 septembre 2019

Laravel 5.8: How to exclude a page from default redirection when user is not authorized

In Laravel all pages are redirected to login page for unauthorized users (Guest). How to exclude a page (e.q. Index) from this redirection? I tried changing file below and set return route('login') to return route('index') but it makes infinite index call and Firefox says:

The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

File:

Middleware/Authenticate.php

protected function redirectTo($request)
    {
        if (! $request->expectsJson()) {
            return route('login');
        }
    }



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MOAxub
via IFTTT

Aucun commentaire:

Enregistrer un commentaire