简体   繁体   中英

i can't send any email verification notification in laravel 9

I tried a lot of things throughout the project to figure out why I can't send a confirmation email:) and after all my journey, I realized that my attribute prefix (us_email) is not allowed and I have to write it as "email". even tried to overwrite getEmailForVerification function, but it doesn't worked

public function getEmailForVerification(): string
{
    return $this->us_email;
}

is there any way to use this "us_" prefix as my email attribute name and send email verification notification?

WooooW, i found the solution i use "Accessors & Mutators". its look like i set an alias name for my us_email field

public function email(): Attribute
{
    return Attribute::make(
        get: fn($email) => $this->us_email,
        set: fn($email) => $this->us_email = $email
    );
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM