當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Guard::logout方法代碼示例

本文整理匯總了PHP中Illuminate\Contracts\Auth\Guard::logout方法的典型用法代碼示例。如果您正苦於以下問題:PHP Guard::logout方法的具體用法?PHP Guard::logout怎麽用?PHP Guard::logout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Contracts\Auth\Guard的用法示例。


在下文中一共展示了Guard::logout方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getLogout

 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     $this->auth->logout();
     return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/')->header('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate');
     //return redirect(\URL::previous());
     //return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/')->header('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate')->header('Pragma', 'no-cache')->header('Expires', 'Fri, 01 Jan 1990 00:00:00 GMT');
 }
開發者ID:phanngoc,項目名稱:internal-tool,代碼行數:12,代碼來源:AuthenticatesAndRegistersUsers.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->route('auth.signin');
         }
     } else {
         $user = $this->auth->user();
         if ($user->ban) {
             if ($request->ajax()) {
                 return response('Unauthorized.', 401);
             } else {
                 $this->auth->logout();
                 notify()->flash('Banned', 'error', ['text' => $user->ban_reason]);
                 return redirect()->route('auth.signin');
             }
         }
     }
     /*$ipInfo = getIpInfo($request->getClientIp());
       if($ipInfo){
           if(isset($ipInfo['timezone'])){
               if($ipInfo['timezone'] != $this->auth->user()->timezone){
                   $this->auth->user()->update([
                       'timezone' => $ipInfo['timezone']
                   ]);
               }
           }
       }*/
     return $next($request);
 }
開發者ID:vuonghuuphuc,項目名稱:coder,代碼行數:39,代碼來源:Authenticate.php

示例3: handle

 /**
  * Handle
  * @param User $user
  * @throws UserNotActivatedException
  */
 public function handle(User $user)
 {
     if ($user && !$user->isActivated()) {
         $this->guard->logout();
         throw new UserNotActivatedException();
     }
 }
開發者ID:ymnl007,項目名稱:Usher,代碼行數:12,代碼來源:CheckIfUserIsActivated.php

示例4: handle

 /**
  * Handle
  * @param User $user
  */
 public function handle(User $user)
 {
     if ($user && $user->isBanned()) {
         $this->guard->logout();
         throw new UserIsBannedException('You are banned from the system');
     }
 }
開發者ID:ymnl007,項目名稱:Usher,代碼行數:11,代碼來源:CheckIfUserIsBanned.php

示例5: getLogout

 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     Activity::log('Admin logt uit');
     flash()->message(trans('auth.loggedOut'));
     $this->auth->logout();
     return redirect('/nl/auth/login');
 }
開發者ID:bjrnblm,項目名稱:blender,代碼行數:12,代碼來源:AuthController.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 403);
         } else {
             return redirect()->guest('auth/login');
         }
     }
     if (!$request->user()->isAdmin() && $request->user()->cannot('dashboard_view')) {
         $this->auth->logout();
         return redirect()->guest('auth/login')->withErrors(trans('messages.permission_denied'));
     }
     $route_array = explode('.', $request->route()->getName());
     $permission_name = array_search($route_array[2], array_dot($this->permission_fields));
     if ($permission_name) {
         $route_array[2] = explode('.', $permission_name)[0];
     }
     // $route_name = implode('_', $route_array);
     $route_name = $route_array[1] . '_' . $route_array[2];
     if (!$request->user()->isAdmin() && $request->user()->cannot($route_name)) {
         //PATCH 為null
         if ($request->ajax()) {
             return response()->json(['status' => trans('messages.permission_denied'), 'type' => 'error', 'code' => 403]);
         } else {
             return view('errors.403');
         }
     }
     return $next($request);
 }
開發者ID:hramose,項目名稱:laravel-5-admin,代碼行數:37,代碼來源:Authenticate.php

示例7: handle

 public function handle($request, Closure $next)
 {
     $response = $next($request);
     if ($this->auth->check()) {
         $this->auth->logout();
     }
     return $response;
 }
開發者ID:BinaryStudioAcademy,項目名稱:reviewr,代碼行數:8,代碼來源:Logout.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check() && $this->auth->user()->isBanned()) {
         $this->auth->logout();
         return ujs_redirect(route('users.disabled'));
     }
     return $next($request);
 }
開發者ID:NiHikKi,項目名稱:osu-web,代碼行數:16,代碼來源:CheckUserBanStatus.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->user()->confirmed) {
         $this->auth->logout();
         return redirect()->guest('auth/login')->with('message', "Por favor confirma tu email");
     }
     return $next($request);
 }
開發者ID:villapilla,項目名稱:PHP,代碼行數:15,代碼來源:ConfirmedUser.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         $this->auth->logout();
         return redirect()->back();
     }
     return $next($request);
 }
開發者ID:elberd,項目名稱:maoh,代碼行數:15,代碼來源:RedirectIfAuthenticated.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->check() or $this->auth->user()->is_admin != 1) {
         $this->auth->logout();
         Session::flash('msg', 'Acesso restrito a administradores');
         return redirect('/auth/login');
     }
     return $next($request);
 }
開發者ID:pcfordelone,項目名稱:code_laravel,代碼行數:16,代碼來源:AuthAdmin.php

示例12: logout

 /**
  * Log user out.
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function logout()
 {
     // Save user id to use later
     $userId = $this->auth->user()->id;
     // Log user out and fire event
     $this->auth->logout();
     event(new UserLoggedOut($userId));
     return redirect(\URL::previous());
 }
開發者ID:bitller,項目名稱:nova,代碼行數:14,代碼來源:LoginController.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         if ($this->auth->user()->confirmed !== 1) {
             $this->auth->logout();
             return redirect('auth/login')->withErrors(['Mensaje Vinil-Shirt', 'Login Fallido, debes validar tu Email']);
         }
     }
     return $next($request);
 }
開發者ID:jortiz-el,項目名稱:PhP,代碼行數:17,代碼來源:RedirectIfValidMail.php

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->user()->is_admin) {
         $errors = new MessageBag();
         $errors->add('adminarea', 'Restricted Area. Please use a admin login.');
         $this->auth->logout();
         return view('auth.login', compact('errors'));
     }
     return $next($request);
 }
開發者ID:eduohe,項目名稱:PHPLaravelEcommerce,代碼行數:17,代碼來源:IsAdmin.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // TODO:    don't automatically log the user out some time after
     //          issue #29 is fixed or when disabled_at starts being used for
     //          something other than merged accounts.
     if ($this->auth->check() && $this->auth->user()->disabled_at !== null && !($request->getMethod() === 'POST' && $request->getRequestUri() == '/auth/logout')) {
         $this->auth->logout();
         //            return Response::view('home.account-disabled', ['username' => $this->auth->user()->username], 403);
     }
     return $next($request);
 }
開發者ID:nsystem1,項目名稱:Pony.fm,代碼行數:18,代碼來源:DisabledAccountCheck.php


注:本文中的Illuminate\Contracts\Auth\Guard::logout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。