当前位置: 首页>>代码示例>>PHP>>正文


PHP Auth::logout方法代码示例

本文整理汇总了PHP中App\Http\Middleware\Auth::logout方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::logout方法的具体用法?PHP Auth::logout怎么用?PHP Auth::logout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Http\Middleware\Auth的用法示例。


在下文中一共展示了Auth::logout方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->user()->is_admin) {
         return redirect('/admin/dashboard');
     }
     if (!$request->user()->is_active) {
         \Auth::logout();
         return redirect('/auth/login')->withErrors(['deactivated' => 'Your account has been deactivated.  Contact admin for more information.']);
     }
     return $next($request);
 }
开发者ID:2dan-devs,项目名称:williamnavasphoto,代码行数:18,代码来源:ClientsOnly.php

示例2: handle

 /**
  * Handles the user activation.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!\Auth::user()->active) {
         flash()->overlay('You must activate your account. Check your email.', 'Whoops.');
         return redirect('/');
     }
     if (\Auth::user()->locked_out) {
         //This is for backup and restore operations, see BackupController@lockUsers
         flash()->overlay("You are temporarily locked out during system maintenance.  Wait a few minutes and\n            try again, your account will be unlocked soon.", 'Whoops.');
         \Auth::logout();
         return redirect('/');
     }
     return $next($request);
 }
开发者ID:roehlerw,项目名称:Kora3,代码行数:21,代码来源:IsActive.php

示例3: 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()->guest('auth/login');
         }
     }
     if (session_id() != \Auth::user()->last_session) {
         Auth::logout();
         return true;
     }
     return $next($request);
 }
开发者ID:WillLiang918,项目名称:patient_database,代码行数:22,代码来源:Authenticate.php

示例4: handle

 public function handle($request, Closure $next)
 {
     $rol = $this->auth->user()->getRol();
     if ($rol == "Administrador") {
         return view('administrator');
     } elseif ($rol == "Institución") {
         return view('institution');
     } elseif ($rol == "Gestor") {
         return view('agent');
     } else {
         return view('auth.login');
     }
     Auth::logout();
     return $next($request);
 }
开发者ID:jonavargas,项目名称:Sistema-Centralizaci-n,代码行数:15,代码来源:Rol.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $response = $next($request);
     if (\Auth::check()) {
         $user = \Auth::user();
         if ($user->isBanned()) {
             \Auth::logout();
             if ($request->ajax()) {
                 return response('Unauthorized.', 401);
             } else {
                 flash()->error('Ban');
                 return redirect('/');
             }
         }
     }
     return $response;
 }
开发者ID:psiskova,项目名称:blog-academy,代码行数:24,代码来源:CheckForBanUser.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!LibraryFactory::getInstance('Permission')->hasPageAccess(request()->getRequestUri())) {
         //Check if user group is deleted and no feature at all
         // Log this user out or else it will cause limbo
         $canAccess = false;
         $userRoles = LibraryFactory::getInstance('Role')->getRoles(auth()->user()->id);
         if ($userRoles->isEmpty()) {
             // logout user
             \Auth::logout();
             session()->flush();
             return redirect('/')->with('error', 'Unauthorized Access.');
         }
         return back()->with('error', 'Unauthorized Access.');
     }
     return $next($request);
 }
开发者ID:atudz,项目名称:gorabelframework,代码行数:24,代码来源:PageAccessMiddleware.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (isAdmin() || isCustomer()) {
         \Auth::logout();
     }
     // Panelist HTTP Basic Auth
     if (isset($_SERVER['PHP_AUTH_USER'])) {
         $email = $_SERVER['PHP_AUTH_USER'];
         $count = User::whereEmail($email)->has('panelist_profile')->count();
         if ($count == 1) {
             return \Auth::basic('email') ?: $next($request);
         } else {
             return \Auth::basic('email');
         }
     } else {
         return \Auth::basic('email');
     }
 }
开发者ID:abrarjahin,项目名称:Laravel_5.1_test_project_to_look_at,代码行数:25,代码来源:CheckPanelistMiddleware.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $response = $next($request);
     $user = \Auth::user();
     if ($user != null && $user->enabled == 0) {
         \Auth::logout();
         $error = new \Illuminate\Support\MessageBag();
         $error->add('Disalbed', 'User is not enabled.');
         return redirect('auth/login')->with(['errors' => $error]);
     } else {
         if ($user != null && isAdmin()) {
             return redirect('admin/dashboard');
         } else {
             if ($user != null && isCustomer()) {
                 return redirect('members/dashboard');
             }
         }
     }
     return $response;
 }
开发者ID:abrarjahin,项目名称:Laravel_5.1_test_project_to_look_at,代码行数:27,代码来源:CheckEnabledMiddleware.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->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('/');
         }
     }
     if (\Auth::user()->archive == 1) {
         $email = \Auth::user()->email;
         \Auth::logout();
         return view('auth.suspended_user', compact('email'));
     }
     if (!\Auth::user()->isActive()) {
         $email = \Auth::user()->email;
         $date = \Auth::user()->created_at->format('Y-m-d');
         \Auth::logout();
         return view('auth.guest_activate')->with('email', $email)->with('date', $date);
     }
     return $next($request);
 }
开发者ID:bradsmithcan,项目名称:laravel_infusionsoft_constantcontact,代码行数:29,代码来源:Authenticate.php


注:本文中的App\Http\Middleware\Auth::logout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。