Skip to content

Instantly share code, notes, and snippets.

@patrickcurl
Created August 11, 2021 23:39
Show Gist options
  • Save patrickcurl/9ada346dc00a0a5749979f44dfbfc4de to your computer and use it in GitHub Desktop.
Save patrickcurl/9ada346dc00a0a5749979f44dfbfc4de to your computer and use it in GitHub Desktop.
Laravel Breeze Tutorial -- LoginRequest -- authenticate
<?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