Model needs to implement theIlluminate\Contracts\Auth\Authenticatableinterface
use Illuminate\Contracts\Auth\Authenticatable
class YourClass extends Model implements Authenticatable
{
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am using the laravel registration form. On the RegisterController I am checking the response body. On captcha failure, I am trying to redirect the user to the register page. Pretty simple right? Here is the code
$response = Zttp::asFormParams()->post('https://www.google.com/recaptcha/api/siteverify',[
'secret' => config('services.recaptcha.secret'),
'response' => $data['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
]);
$response_body = json_decode($response->getBody(), true);
if($response_body['success'] == false){ // redirect and abort
return redirect()->route('register');
}
On the captcha failure instead of simpy redirecting, it throws the following error:
Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, instance of Illuminate\Http\RedirectResponse given, called in
I just want to redirect to the register page
Please or to participate in this conversation.