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


PHP Auth::check方法代码示例

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


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

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!\Auth::check('volunteer')) {
         return redirect('/volunteer');
     }
     return $next($request);
 }
开发者ID:gospelslide,项目名称:cry_final,代码行数:14,代码来源:VolunteerGuest.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!(\Auth::check() && !\Auth::user()->isBanned())) {
         return redirect('banned')->withErrors('User is banned.');
     }
     return $next($request);
 }
开发者ID:Pheonick,项目名称:whatsnext,代码行数:14,代码来源:notbanned.php

示例3: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!(\Auth::check() && \Auth::user()->isAdmin())) {
         return redirect('/')->withErrors('Access denied to ADMIN functionality!');
     }
     return $next($request);
 }
开发者ID:Pheonick,项目名称:whatsnext,代码行数:14,代码来源:admin.php

示例4: handle

 public function handle($request, Closure $next)
 {
     if (\Auth::check() && \Auth::user()->isNotChild() && \Auth::user()->isActive()) {
         return $next($request);
     }
     return redirect('home');
 }
开发者ID:bradsmithcan,项目名称:laravel_infusionsoft_constantcontact,代码行数:7,代码来源:NotChild.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $roleName)
 {
     if (Auth::check() && !Auth::user()->hasRole($roleName)) {
         return abort(401, 'Unauthorized');
     }
     return $next($request);
 }
开发者ID:muhamadanjar,项目名称:SIMTARU,代码行数:14,代码来源:LevelMiddleware.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (\Auth::check('admin')) {
         return redirect('/systems');
     }
     return $next($request);
 }
开发者ID:dangquanglight,项目名称:light-love-story,代码行数:14,代码来源:AdminGuest.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (\Auth::check()) {
         return redirect()->route('home');
     }
     return $next($request);
 }
开发者ID:Synthx,项目名称:Acamar,代码行数:14,代码来源:NotLogged.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $role)
 {
     if (\Auth::check() && !\Entrust::hasRole($role)) {
         return redirect()->back();
     }
     return $next($request);
 }
开发者ID:Tamzidi,项目名称:tracerstudy,代码行数:14,代码来源:RoleMiddleware.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Auth::check()) {
         return redirect('/login');
     }
     return $next($request);
 }
开发者ID:pierreboivin,项目名称:bgg_app,代码行数:14,代码来源:AppIsLogin.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::check() && Auth::user()->user_typeId == 3) {
         return $next($request);
     } else {
         return redirect('');
     }
 }
开发者ID:premsingh4github,项目名称:SchoolUmbrella,代码行数:15,代码来源:ParentMiddleware.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (\Auth::check()) {
         $expiresAt = Carbon::now()->addMinutes(5);
         Cache::put('user-is-online-' . \Auth::user()->id, true, $expiresAt);
     }
     return $next($request);
 }
开发者ID:Bottelet,项目名称:Flarepoint-crm,代码行数:15,代码来源:LogLastUserActivity.php

示例12: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (\Auth::check() || \Session::has('lockscreen')) {
         return $next($request);
     } else {
         return redirect('/account/login');
     }
 }
开发者ID:DiCore,项目名称:hours,代码行数:15,代码来源:LockScreen.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $user = $request->user();
     if (!\Auth::check() || !$user->hasRole('super_admin')) {
         return redirect("/error");
     }
     return $next($request);
 }
开发者ID:Dreamerpro,项目名称:thinkmerit.api,代码行数:15,代码来源:SuperAdmin.php

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $user = Session::get('auth_user');
     if (!$user || !\Auth::check()) {
         Session::put('url.intended', Request::url());
         return redirect('login');
     }
     return $next($request);
 }
开发者ID:shyam-achuthan,项目名称:social-login,代码行数:16,代码来源:MemberAuthenticationMiddleware.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (\Auth::check()) {
         if ($request->id == \Auth::user()->id) {
             return redirect('/user');
         }
     }
     return $next($request);
 }
开发者ID:kittaka1222takashi,项目名称:dokoiko,代码行数:16,代码来源:ConfirmLoginUser.php


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