简体   繁体   中英

Sending more than the default data to message view on Laravel 5.1 PasswordResets

I'm a newbie on Laravel and wanted to know that if there is a way in which you could send more than the default data to the message view (the one that contains the message of the sent email for resetting password)?

The default data that it receives includes just the token and user info. My user table has: id, username, email, password, user_role. But I have another table "seller" that contains the name and last_name fields and of course the foreign key that connects seller with user, so, I want to retrieve the name from the seller table also and send it to the view of the sent message, any ideas?, I've done it modifying the trait that sends the email, but, I've been told that modifying traits is not a good idea. How can I do this without modifying them?, I'm using laravel 5.1, by the way.

Thanks!

There is a trait called Illuminate\\Foundation\\Auth\\ResetsPasswords . It has a bunch of functions that do the job.

You only need to find the function you want to edit and copy that in the App\\Http\\Controllers\\Auth\\PasswordController and edit the content of the function as you wish.

By doing this you are simply over-riding the default function by your own custom function.

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