Laravel 8 Conditional Login Redirect
Did this help you?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi folks,
I want to redirect the user after successful registration to one more page before the admin page.
Where I can redirect after successful registration in the Laravel 8 jetstream app and only after registration not login etc.
Thank you in advance.
Create app/Http/Responses/RegisterResponse.php
<?php
namespace App\Http\Responses;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Response;
use Laravel\Fortify\Contracts\RegisterResponse as RegisterResponseContract;
class RegisterResponse implements RegisterResponseContract
{
public function toResponse($request)
{
// below is the existing response
// replace this with your own code
return $request->wantsJson()
? new JsonResponse('', 201)
: redirect(config('fortify.home'));
}
}
In JetstreamServiceProvider in the boot method register it
public function boot()
{
// other code
// register new RegisterResponse
$this->app->singleton(
\Laravel\Fortify\Contracts\RegisterResponse::class,
\App\Http\Responses\RegisterResponse::class
);
}
Please or to participate in this conversation.