Last Updated: January 28, 2019
·
11.65K
· wern

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'));
});

});

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside