Created
August 11, 2021 23:39
-
-
Save patrickcurl/9ada346dc00a0a5749979f44dfbfc4de to your computer and use it in GitHub Desktop.
Laravel Breeze Tutorial -- LoginRequest -- authenticate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Attempt to authenticate the request's credentials. | |
* @return void | |
* | |
* @throws \Illuminate\Validation\ValidationException | |
*/ | |
public function authenticate() | |
{ | |
$this->ensureIsNotRateLimited(); | |
if (!Auth::attempt( | |
$this->only($this->loginField, 'password'), | |
$this->boolean('remember') | |
)) | |
{ | |
RateLimiter::hit($this->throttleKey()); | |
throw ValidationException::withMessages([ | |
'login' => __('auth.failed') | |
]); | |
} | |
RateLimiter::clear($this->throttleKey()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment