To implement Google Recaptcha in Laravel check our article on implementing Google Recaptcha for Laravel registration.
in /app/Http/Controllers/Auth/LoginController.php
Add the following lines:
use Illuminate\Http\Request;
use App\Rules\GoogleRecaptcha;
And before theclosing curly brackets:
/**
* Validate the user login request.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
protected function validateLogin(Request $request)
{
$this->validate($request, [
$this->username() => 'required|string',
'password' => 'required|string',
'g-recaptcha-response' => ['required', new GoogleRecaptcha],
]);
}