예제 #1
0
 public function __construct()
 {
     // 本地化设置
     $this->setLocale();
     // 权限判断
     $this->beforeFilter(function () {
         // 如果已经登录
         if (Auth::check()) {
             // 如果是 Ajax 请求
             if (Request::ajax()) {
                 // 记录日志
                 $this->writeActionLog();
                 // 判断权限
                 if (!$this->checkPrivileges()) {
                     return KTAnchor::showSlidMessage(Lang::get('login.You have no rights'));
                 }
                 // 返回空
                 // return;
             } else {
                 $account = Auth::user()["attributes"]["email"];
                 return view('__portal', ["locale" => $this->locale, "account" => $account]);
             }
         } else {
             // 如果是 Ajax 请求
             if (Request::ajax()) {
                 return KTAnchor::showSlidMessage(Lang::get('login.Session Timeout'));
             } else {
                 return KTAnchor::topLocation('/login');
             }
         }
     });
 }
예제 #2
0
 public function signout()
 {
     Auth::logout();
     return KTAnchor::topLocation('/login');
 }