In Laravel Fortify, the default redirect after email verification is defined in the VerificationController class. To modify the redirect URL, you can override the redirectTo method in your own VerificationController class.
Here's an example of how you can define a different URL for the redirect:
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\RedirectResponse;
class VerificationController extends Controller
{
/**
* Redirect the user after email verification.
*
* @param \Illuminate\Foundation\Auth\EmailVerificationRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
protected function redirectTo(EmailVerificationRequest $request): RedirectResponse
{
// Define your custom redirect URL here
return redirect()->to('https://example.com/mobile-app-page');
}
}
Make sure to update the namespace and the redirect URL according to your application's needs. After creating this VerificationController class, you need to update the fortify.php configuration file to use your custom controller.
In config/fortify.php, locate the features array and update the email_verification section to use your custom controller:
'features' => [
// ...
'email_verification' => [
'enabled' => true,
'controller' => App\Http\Controllers\Auth\VerificationController::class,
],
// ...
],
By doing this, the email verification redirect will be handled by your custom controller, and you can define any URL you want in the redirectTo method.