[英]Laravel 5.4 Password Reset
I have a Laravel 5.4 application and I have a view in my admin area that allows me to see all users. 我有一个Laravel 5.4应用程序,我在我的管理区域有一个视图,允许我查看所有用户。
I want to create a function that allows me to click a button in the back end that automates the process of sending the default Laravel password reset functionality. 我想创建一个函数,允许我单击后端的按钮,自动执行发送默认Laravel密码重置功能的过程。
In my view I have the following: 在我看来,我有以下几点:
<table class="table table-hover">
<thead>
<th>#</th>
<th>Company</th>
<th>Name</th>
<th>Email Address</th>
<th>Action</th>
</thead>
<tbody>
@foreach(\App\User::all() as $c)
<tr>
<td>{{ $c->id }}</td>
<td>{{ $c->company->company_name }}</td>
<td>{{ $c->name }}</td>
<td>{{ $c->email }}</td>
<td><a href="/admin/user/{{ $c->id }}/password/reset">Password Reset</a></td>
</tr>
@endforeach
</tbody>
</table>
On the link click for resetting the password this currently via my routes hits the following function 在链接上单击以重置密码,此当前通过我的路由命中以下功能
public function passwordReset($id)
{
$user = User::FindOrFail($id);
Password::sendResetLink($user->email);
}
I'm not to familiar with Laravels default password reset functionality so I'm probably way off but I get the following error: 我不熟悉Laravels默认密码重置功能,所以我可能会离开但是我收到以下错误:
Argument 1 passed to Illuminate\\Auth\\Passwords\\PasswordBroker::sendResetLink() must be of the type array, string given,
传递给Illuminate \\ Auth \\ Passwords \\ PasswordBroker :: sendResetLink()的参数1必须是类型数组,字符串给定,
您需要发送一个包含email
的数组作为密钥:
Password::sendResetLink(['email' => $user->email]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.