dembilesmana's avatar

how resolve route [verification.verify] not define?

how to change route verification.verify value in laravel?

protected function verificationUrl($notifiable)
{
	return URL::temporarySignedRoute(
		'verification.verify', // Change this in laravel?
		Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
		[
			'id' => $notifiable->getKey(),
			'hash' => sha1($notifiable->getEmailForVerification()),
		]
	);
}

because my route is like this:

Route::domain(config('app.client'))->namespace('client')->name('client::')->group(function () {
    Auth::routes(['verify' => true]);

    Route::middleware(['auth:client', 'verified'])->group(function () {
        Route::get('/', 'HomeController@index')->name('home');
        Route::get('paying', 'PayingController@index')->name('paying');
        Route::get('profile', 'ProfileController@index')->name('profile');
        Route::post('profile', 'ProfileController@update')->name('profile.update');
    });
});

so I have the name of the route client::verification.verify not verification.verify

how do i resolve this?

0 likes
14 replies
Snapey's avatar

use php artisan route:list to determine all your routes.

duplicate all the auth routes then remove Auth::routes() from web.php

modify the verification route to suit your needs.

dembilesmana's avatar

thank you for answering, but the purpose of my question is how can I change the value of URL::temporarySignedRoute('verification,verify', <-- change this ....).

because by default laravel calls a route 'verification.verify' whereas I have that route with the prefix name client:: be like this 'client::verification.verify'. because auth::routes() I wrap it in a group with name 'client::'.

Snapey's avatar

Thats what I gave you.

Once you define all the routes yourself, instead of using Auth::routes(), then you can change the URL for the route with the name verification.verify

You cannot stop the framework calling for a route called verification.verify since as you know, it is embedded in the framework, but you can create a route with that name that either performs the verification or redirects to the built in version

1 like
dembilesmana's avatar

I understand, but is there no other way like using 'trait' maybe?

or if I make a special notification to replace it can it? if yes how to call it, I have repeatedly read the documentation about the notification but do not understand how to apply it to the problem I am facing this.

Snapey's avatar

why not just move the auth routes outside of the name=client:: namespace?

dembilesmana's avatar

Because I have a router admin that also uses auth::routes().

so I made the admin and client models. I separate it from the subdomain admin.app.dev and client.app.dev, where each subdomain has a login and register form for clients only.

is there a solution for that?

Snapey's avatar

Add this function to your user model

    public function sendEmailVerificationNotification()
    {
        $this->notify(new VerifyEmail);
    }

Create a new VerifyEmail notification and reference it in the user model code (above)

Copy the code from vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php into your notification class

change the name of the route in your version of the class.

Mikegk's avatar

Simply add

Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');

On the bottom of your web.php routes file.

3 likes
acv2's avatar

Maybe a bit late, but i hope this help someone.

If you are using Laravel 8.x with jetstream package you dont need

Auth::routes();

Instead just go to your 'config/fortify.php' and enable the emailVerification feature,

use Laravel\Fortify\Features;

'features' => [
    Features::registration(),
    Features::resetPasswords(),
    Features::emailVerification(), //uncomment this line
    Features::updateProfileInformation(),
    Features::updatePasswords(),
    Features::twoFactorAuthentication(),
],

Let, me know if this helps or if you need more details

11 likes
Snapey's avatar

a) late

b) not related to the question

redx1t's avatar

Auth::routes(['verify' => true]);

To enable verification routes

2 likes
knuto's avatar

You need to add

Features::emailVerification(),

to the Fortify features array (config/fortify.php)

1 like

Please or to participate in this conversation.