Search code examples
lumen

Where have I to define email for UrlGenerator?


In my lumen 8.0 app I want to add Resets Passwords functionality reading Trying to reset Passwords in Lumen article but I got error :

: Route [password.reset] not defined. at /mnt/_work_sdb8/wwwroot/LumenProjects/PublishPagesAPI/vendor/laravel/lumen-framework/src/Routing/UrlGenerator.php:231)

and checking related code I see in Notifications/ResetPassword.php:

public function toMail($notifiable)
{
    \Log::info(  varDump($notifiable, ' -1 $notifiable::') );
    \Log::info(  varDump(static::$toMailCallback, ' -2 static::$toMailCallback::') );
    if (static::$toMailCallback) {
        return call_user_func(static::$toMailCallback, $notifiable, $this->token);
    }

    \Log::info(  varDump(static::$createUrlCallback, ' -3 static::$createUrlCallback::') );
    if (static::$createUrlCallback) {
        $url = call_user_func(static::$createUrlCallback, $notifiable, $this->token);
    } else {

        $url = url(route('password.reset', [
            'token' => $this->token,
            'email' => $notifiable->getEmailForPasswordReset(),
        ], false));
    }

    return $this->buildMailMessage($url);
}

and checking log I see :

[2021-07-01 13:35:04] local.INFO: NULL : -2 static::$toMailCallback:: : NULL  
[2021-07-01 13:35:04] local.INFO: NULL : -3 static::$createUrlCallback:: : NULL 

Looks like in some config file I have to set these variables? Could you please point where and which parameters?

Also as this article was written for lumex 5, if Notifications good decision for lumen 8?

Thanks!


Solution

  • Valid decision was to update config/auth.php with : 'password' => [ 'users' => [ 'provider' => 'users', 'email' => 'auth.emails.password', 'table' => 'passwords_resets', 'expire' => 60, ], ]