vendredi 3 août 2018

Login page OR "home" page on the same URL (Laravel 5.6)

Root page (with "/" URL) of my website should be login page (with login form) (Laravel 5 stock Auth). After user is logging in he should see his account page on the same root URL (/). How I should do it properly?

My idea is like this:

Route::get('/', function(){
        if (Auth::guest()) {
            return view('auth.login');
        } else {
            return view('account.index');
        }
});

But is is correct? It not looks like it's okay. May be I should use middleware or something else? I tried but without success.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire