cooperino's avatar

Custom Verification email - how to get the verification URL?

There are two ways to add new users to my app: One via registration, and one after registration when an admin adds users to his account. So I wanted to create a custom verification notification for when an admin adds a user to his accout. (And then be able to choose which email format to send)

At first I override the sendEmailVerificationNotification method:

    public function sendEmailVerificationNotification()
    {
        $this->notify(new Notifications\customUserVerificationEmail);
    }

But then in customUserVerificationEmail, how do I get the verification url in the toMail method?

    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject('Please verify your email address')
            ->markdown(
                'emails.verify',
                [
                    'url' =>// where do I get this $url from?
                    'notifiable' => $notifiable,
                ]
            );
    }

Edit: My solution above could be completely wrong. What I'm trying to achieve is just a way to send two different looking verification emails based on the type of registration, so maybe there is another way

0 likes
2 replies

Please or to participate in this conversation.