简体   繁体   English

向Laravel 5.1 PasswordResets的消息视图发送更多的默认数据

[英]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)? 我是Laravel的新手,想知道是否可以通过某种方式将更多的默认数据发送到消息视图(该消息包含用于重置密码的已发送电子邮件的消息)?

The default data that it receives includes just the token and user info. 它接收的默认数据仅包括令牌和用户信息。 My user table has: id, username, email, password, user_role. 我的用户表有:ID,用户名,电子邮件,密码,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. 但是我还有另一个表“ seller”,其中包含name和last_name字段,当然还有将卖方与用户连接的外键,因此,我也想从卖方表中检索名称并将其发送到已发送消息的视图中,有什么想法吗?,我已经完成了修改发送电子邮件的特征的操作,但是,有人告诉我,修改特征不是一个好主意。 How can I do this without modifying them?, I'm using laravel 5.1, by the way. 顺便说一句,我如何使用laravel 5.1而不修改它们?

Thanks! 谢谢!

There is a trait called Illuminate\\Foundation\\Auth\\ResetsPasswords . 有一个名为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. 您只需要找到要编辑的功能并将其复制到App\\Http\\Controllers\\Auth\\PasswordController然后根据需要编辑该功能的内容。

By doing this you are simply over-riding the default function by your own custom function. 这样,您就可以用自己的自定义功能覆盖默认功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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