/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { $router->filter('auth', function () { if (Auth::guest()) { if (Request::ajax()) { return Response::make('Unauthorized', 401); } else { return Redirect::guest('/'); } } }); $router->filter('auth.basic', function () { return Auth::basic(); }); $router->filter('guest', function () { if (Auth::check()) { return Redirect::to('/'); } }); $router->filter('admin', function () { if (Auth::check()) { if (Auth::user()->email != "*****@*****.**") { return Redirect::to('/'); } } else { return Redirect::to('/'); } }); parent::boot($router); }