Laravel 11 Fortify error Route [/email/verification-notification] not defined

  Kiến thức lập trình

I’m trying to implement an auth system with Laravel 11 Fortify that requires email verification.

1)
In order to implement the feature to send a new verification link, the docs say:

If you wish, you may add a button to your application’s verify-email template that triggers a POST request to the /email/verification-notification endpoint.

so I did.

2) In my verify-email.blade.php I did

@extends('layouts.public')

@section('body')
    <h1>Please go to your email and click the link to verify your E-Mail address</h1>
    <form action="{{ route('email/verification-notification') }}" method="POST">
        @csrf
        <div>I recieved no E-Mail! </div><button type="submit">Send new verify E-Mail</button>
    </form>
@endsection

3) When I now register a new user and been redirected to that verify-email view, I get the error message that the route for email/verification-notification is not defined.

Route [/email/verification-notification] not defined.

However, when I check the routes with php artisan route:list, it shows me that this route does exist.

root@7ee35776a20b:/var/www/html# php artisan route:list
  ...
  POST      email/verification-notification ..... verification.send › LaravelFortify › EmailVerificationNotificationController@store
  GET|HEAD  email/verify ..... verification.notice › LaravelFortify › EmailVerificationPromptController@__invoke
  GET|HEAD  email/verify/{id}/{hash} ..... verification.verify › LaravelFortify › VerifyEmailController@__invoke
  ...

I’ve been following the instructions from the docs step by step, but still this is not working.

How do I properly implement email verification so that I’m able to re-send a verification link, when needed?

LEAVE A COMMENT