D
D
Dimon3x2019-06-06 22:29:17
Laravel
Dimon3x, 2019-06-06 22:29:17

How to generate a link to confirm registration?

I customize registration in version 5.7
Overridden the method in the User class

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

Now what should be written in ->action to form a link?
should be approximately the same as without customization
http://localhost/email/verify/7?expires=1559851687&signature=
f2ce7be49045c1c86314a2d8d0229ebf2322452460607803cb1b002a470c9309

and now this
http://localhost/email/verify
namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class CustomVerifyEmail extends Notification
{
    use Queueable;

    public function via($notifiable)
    {
        return ['mail'];
    }

    public function toMail($notifiable)
    {
        return (new MailMessage)
                     ->subject('Уведомление для подтверждения регистрации')
                     ->salutation('С уважением, администрация сайта.')
                 ->line('Что бы использовать дополнительные возможности сайта, надо подтвердить регистацию')
                     ->action('Подтвердить пароль', url('email/verify'))

                    ->line('Срок действия ссылки для подтверждения пароля истекает через 60 минут.');
    }

    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
eldario, 2019-06-11
@eldario666

The facade has a temporarySignedRouteURL method
Use .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question