Laravel logout
Route::filter('nocache', function($route, $request, $response)
{
$response->header('Expires', 'Tue, 1 Jan 1980 00:00:00 GMT');
$response->header('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
$response->header('Pragma', 'no-cache');
return $response;
});
Route::group(array('before' => 'auth', 'after' => 'nocache'), function()
{
Route::get('/admin', function(){
return 'Im an admin page';
});
Route::get('/admin/logout', function(){
Session::flush();
Auth::logout();
return Redirect::to("/login")
->with('message', array('type' => 'success', 'text' => 'You have successfully logged out'));
});
});
Written by Wern Ancheta
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#