由于文件路径在laravel中更改了password.blade?(As the file path changes password.blade in laravel?)

系统教程 行业动态 更新时间:2024-06-14 17:02:18
由于文件路径在laravel中更改了password.blade?(As the file path changes password.blade in laravel?)

我正在做一个简单的应用程序laravel 5.1,我想重置用户的密码。 我没有问题。

我还没有找到改变某些文件路径的方法。 其中包括文件“password.blade.php”,它是发送给用户邮件的内容,其中包含令牌的链接。 此文件必须位于Resources / views / emails / route中。

是否要更改:文件的名称和路径。 ? 或者,如果您可以选择要发送的其他视图?

谢谢,任何信息将不胜感激)。

I'm doing a simple application laravel 5.1, and I want to reset the password for users. I dont have a problem with that.

I just have not found a way to change the path of some files. Among them is file "password.blade.php" which is what is sent to the user's mail containing the link to the token. This file must be in the Resources / views / emails / route.

Would you like to change: the name and path of the file. ? Or if you can select a different view to be sent?

Thank you, any information would be appreciated ).

最满意答案

PasswordBroker中有一个$ emailView变量。

/** * The view of the password reset link e-mail. * * @var string */ protected $emailView;

如果在密码控制器中将其设置为视图,则应该能够更改其路径和名称。

如果它不起作用,您可以覆盖密码控制器中的emailResetLink函数并更改其中的视图。 这是来自Laravel 5.2的那个。 如果不同,您可以从PasswordBroker.php获取5.1。

/** * Send the password reset link via e-mail. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @param string $token * @param \Closure|null $callback * @return int */ public function emailResetLink(CanResetPasswordContract $user, $token, Closure $callback = null) { // We will use the reminder view that was given to the broker to display the // password reminder e-mail. We'll pass a "token" variable into the views // so that it may be displayed for an user to click for password reset. $view = $this->emailView; return $this->mailer->send($view, compact('token', 'user'), function ($m) use ($user, $token, $callback) { $m->to($user->getEmailForPasswordReset()); if (! is_null($callback)) { call_user_func($callback, $m, $user, $token); } }); }

There is an $emailView variable in PasswordBroker.

/** * The view of the password reset link e-mail. * * @var string */ protected $emailView;

If you set this to your view in your Password Controller, you should be able to change it's path and name.

If it doesn't work you can overwrite the emailResetLink function in your Password controller and change the view there. Here is the one from Laravel 5.2. You can get 5.1 from your PasswordBroker.php if it's different.

/** * Send the password reset link via e-mail. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @param string $token * @param \Closure|null $callback * @return int */ public function emailResetLink(CanResetPasswordContract $user, $token, Closure $callback = null) { // We will use the reminder view that was given to the broker to display the // password reminder e-mail. We'll pass a "token" variable into the views // so that it may be displayed for an user to click for password reset. $view = $this->emailView; return $this->mailer->send($view, compact('token', 'user'), function ($m) use ($user, $token, $callback) { $m->to($user->getEmailForPasswordReset()); if (! is_null($callback)) { call_user_func($callback, $m, $user, $token); } }); }

更多推荐

本文发布于:2023-04-21 18:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/1866fcfa7c6bf28ea23999b59afdc3fa.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:改了   路径   文件   file   path

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!