Advertisement
rodro1

Laravel Constructor session work

Sep 26th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1.  public function __construct()
  2.     {  
  3.         $this->middleware(function ($request, $next) {
  4.             //dd(session()->get('logged_in'));
  5.             if(session()->get('logged_in') == NULL)
  6.             {  
  7.                 session()->flash('flash-danger', 'Please login with your username and password');
  8.                 return redirect('admin/login');
  9.             }else{
  10.                 return $next($request);
  11.             }
  12.         });
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement