lundi 13 novembre 2017

Redirect User to Login Page When Session Expires - Laravel

I am trying to redirect a user back to the login page if their session has expired. I am using Laravel 5.5. I have edited my RedirectIfAuthenticated file to include the following code in the handle function:

if (!Auth::check()) {
    return redirect()->route('login', ['account' => 'demo']);
}

When I do this, I am receiving the following error message:

Missing required parameters for [Route: login] [URI: /].

My login route is inside a subdomain route group which is why I am passing the account parameter. Here is part of my code in web.php

// Subdomain routing
Route::domain('{account}.ems.dev')->group(function () {
    Route::get('/', 'LoginController@show')->name('login');
}

Any help is greatly appreciated! Nothing I have tried works. I keep getting the exact same error message even though I am passing in the required parameters.



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

Aucun commentaire:

Enregistrer un commentaire