Reputation: 676
I want to make prevent access to visited page after logout from the laravel project. Here I have used laravel middleware
Route::group(['middleware' => ['web']], function ()
{
Route::get('/logout',[
'uses'=>'UserController@getLogout',
'as'=>'logout'
]);
});
I have included the all the routes in above Route::group route and used auth facade. I want to prevent to access visited page after logout and after accidentally pressing the back button from the browser.
Upvotes: 1
Views: 841
Reputation: 26278
Laravel Route middleware can be used to allow only authenticated users to access a given route. All you need to do is attach the middleware to a route definition:
Route::get('profile', ['middleware' => 'auth', function() {
// Only authenticated users may enter...
}]);
Check this Laravel Auth Documentation
Upvotes: 2