當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Sentinel::getUserProvider方法代碼示例

本文整理匯總了PHP中Sentinel::getUserProvider方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sentinel::getUserProvider方法的具體用法?PHP Sentinel::getUserProvider怎麽用?PHP Sentinel::getUserProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sentinel的用法示例。


在下文中一共展示了Sentinel::getUserProvider方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: deletePerson

 public function deletePerson($personID)
 {
     if ($personID > 1) {
         if (is_null(\Sentinel::getUserProvider()->getById($personID)->select('id')->value('id'))) {
             $this->createModel()->newQuery()->where('person_id', $personID)->delete();
         } else {
             throw new PersonHasAUserAccountException();
         }
     } else {
         throw new \UnexpectedValueException('Wrong data for person deletion.');
     }
 }
開發者ID:linguisticteam,項目名稱:laravel-boilerplate,代碼行數:12,代碼來源:Person.php

示例2: login

 /**
  * Handle a login request to the application.
  *
  * @param  \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function login(Request $request)
 {
     $this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required']);
     // If the class is using the ThrottlesLogins trait, we can automatically throttle
     // the login attempts for this application. We'll key this by the username and
     // the IP address of the client making these requests into this application.
     $throttles = $this->isUsingThrottlesLoginsTrait();
     if ($throttles && $this->hasTooManyLoginAttempts($request)) {
         return $this->sendLockoutResponse($request);
     }
     $credentials = $this->getCredentials($request);
     $isActivated = \Sentinel::getUserProvider()->isActivated($request->get('email'));
     if (!is_null($isActivated)) {
         if ($isActivated != 1) {
             return redirect()->back()->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => trans('error.auth.not_activated')]);
         }
     }
     if (\Auth::attempt($credentials, $request->has('remember'))) {
         return $this->handleUserWasAuthenticated($request, $throttles);
     }
     // If the login attempt was unsuccessful we will increment the number of attempts
     // to login and redirect the user back to the login form. Of course, when this
     // user surpasses their maximum number of attempts they will get locked out.
     if ($throttles) {
         $this->incrementLoginAttempts($request);
     }
     return redirect()->back()->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => $this->getFailedLoginMessage()]);
 }
開發者ID:linguisticteam,項目名稱:laravel-boilerplate,代碼行數:35,代碼來源:AuthController.php

示例3: handle

 public function handle($userID)
 {
     Sentinel::getUserProvider()->updateLastLoginTimestamp($userID);
 }
開發者ID:linguisticteam,項目名稱:laravel-boilerplate,代碼行數:4,代碼來源:UserHasLoggedInUpdateInfo.php

示例4: index

 public function index()
 {
     $userCount = \Sentinel::getUserProvider()->getAllUsersCount();
     $groupCount = \Sentinel::getGroupProvider()->getAllGroupsCount();
     return view('admin.dashboard', compact('userCount', 'groupCount'));
 }
開發者ID:linguisticteam,項目名稱:laravel-boilerplate,代碼行數:6,代碼來源:Controller.php


注:本文中的Sentinel::getUserProvider方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。