本文整理汇总了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.');
}
}
示例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()]);
}
示例3: handle
public function handle($userID)
{
Sentinel::getUserProvider()->updateLastLoginTimestamp($userID);
}
示例4: index
public function index()
{
$userCount = \Sentinel::getUserProvider()->getAllUsersCount();
$groupCount = \Sentinel::getGroupProvider()->getAllGroupsCount();
return view('admin.dashboard', compact('userCount', 'groupCount'));
}