當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。