$k = Cookie::get('k'); if (!$k) { return Redirect::to('/login'); } $key = Crypt::decrypt($k); if ($key != $encrypt_key) { return Redirect::to('/login'); } if (time() - $login_time >= 86400) { return Redirect::to('/login'); } }); //验证是否为超级管理员 Route::filter('is_super_admin', function () { $admin_id = Cookie::get('admin_id'); $admin = AdminORM::whereId($admin_id)->first(); if ($admin->is_super_admin != BaseORM::ENABLE) { return Redirect::route('forbidden'); } }); Route::filter('auth', function () { if (Auth::guest()) { if (Request::ajax()) { return Response::make('Unauthorized', 401); } else { return Redirect::guest('login'); } } }); Route::filter('auth.basic', function () { return Auth::basic();