当前位置: 首页>>代码示例>>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;未经允许,请勿转载。