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


PHP Auth::check方法代码示例

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


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

示例1: logout

 /**
  *  退出登录
  */
 public function logout()
 {
     if (Auth::check()) {
         Auth::logout();
     }
     return Redirect::to('login');
 }
开发者ID:suhanyujie,项目名称:digitalOceanVps,代码行数:10,代码来源:AuthController.php

示例2: __construct

 /**
  * Create a new authentication controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     if (\Auth::check()) {
         $this->redirectTo = url(\Auth::user()->slug);
     }
     $this->middleware('guest', ['except' => 'logout']);
 }
开发者ID:sarker-zakee,项目名称:poststatus,代码行数:12,代码来源:AuthController.php

示例3: showOptions

 /**
  * Display the specified resource.
  *
  * @return Response
  */
 public function showOptions()
 {
     if (\Auth::check()) {
         return redirect("/home");
     }
     return view("login");
 }
开发者ID:0zy,项目名称:magistra,代码行数:12,代码来源:LoginController.php

示例4: __construct

 /**
  * Create a new authentication controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     if (\Auth::check()) {
         return redirect('/');
     }
     $this->middleware('guest', ['except' => 'getLogout']);
 }
开发者ID:bsmitty54,项目名称:P4,代码行数:12,代码来源:AuthController.php

示例5: postSecure

 public function postSecure()
 {
     if (\Auth::check()) {
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:phanngoc,项目名称:internal-tool,代码行数:8,代码来源:AuthController.php

示例6: logout

 /**
  * Display a login page
  *
  * @return \Illuminate\Http\Response
  */
 public function logout()
 {
     if (!\Auth::check()) {
         return redirect('/login');
     }
     \Auth::logout();
     return redirect('/login');
 }
开发者ID:hannahtinkler,项目名称:too-tool-for-school,代码行数:13,代码来源:AuthController.php

示例7: facebookCallback

 public function facebookCallback()
 {
     $_user = Socialite::driver('facebook')->user();
     $user = User::find($_user->getId());
     $email = $_user->getEmail() ? $_user->getEmail() : '';
     if (!$user) {
         $pass = $this->randomPassword();
         $user = User::create(['id' => $_user->getId(), 'name' => $_user->getName(), 'email' => $email, 'password' => \Hash::make($pass)]);
         $user = User::find($_user->getId());
     }
     $login = \Auth::login($user);
     if (\Auth::check()) {
         return redirect('');
     }
 }
开发者ID:jonstuebe,项目名称:recall,代码行数:15,代码来源:AuthController.php

示例8: login

 public function login()
 {
     if (Auth::check()) {
         return Redirect::to("/dashboard")->with('message', 'You are all-ready logged in');
     }
     return view('login');
 }
开发者ID:utkarsh578,项目名称:obscura-2016,代码行数:7,代码来源:AuthController.php

示例9: handleGitHubCallback

 /**
  * Obtain the user information from GitHub.
  *
  * @return Response
  */
 public function handleGitHubCallback()
 {
     $gh_user = \Socialite::driver('github')->user();
     if (\Auth::check()) {
         $user = \Auth::user();
         $user->github_id = $gh_user->getId();
         $user->github_token = $gh_user->token;
         $user->save();
         return redirect()->action('Auth\\AuthController@edit')->withMessage('Your GitHub account has been connected!');
     }
     $user = User::where('github_id', $gh_user->getId())->first();
     $name = explode(' ', $gh_user->name);
     if ($user) {
         \Auth::login($user);
         $user->github_token = $gh_user->token;
         $user->save();
         return redirect()->intended($this->redirectPath());
     } else {
         $user = User::where('email', $gh_user->getEmail())->first();
         if ($user) {
             return redirect()->back()->withErrors(['github' => 'You have not authorized your SD Hacks account for GitHub. Please log in to do so.']);
         } else {
             $user = new User();
             $user->email = $gh_user->getEmail();
             $user->github_token = $gh_user->token;
             $user->github_id = $gh_user->getId();
             $user->save();
             return view('auth.success');
         }
     }
 }
开发者ID:axsauze,项目名称:SDHacks,代码行数:36,代码来源:AuthController.php

示例10: getLogout

 public function getLogout()
 {
     $redirect = route('home');
     if (\Auth::check()) {
         if (\Auth::user()->role_id == 1) {
             $redirect = route('adminLogin');
         }
         if (\Auth::user()->role_id == 2) {
             $redirect = route('broadcasterLogin');
         }
         \Auth::logout();
     }
     return redirect($redirect);
 }
开发者ID:jerryamatya,项目名称:broadcaster,代码行数:14,代码来源:AuthController.php

示例11: redirectPath

 protected function redirectPath()
 {
     if (\Auth::check()) {
         return \Auth::user()->role->redirect;
     }
 }
开发者ID:satriashp,项目名称:tour,代码行数:6,代码来源:AuthController.php


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