Laravel 5.4密码重置 [英] Laravel 5.4 Password Reset
问题描述
我有一个Laravel 5.4应用程序,并且在我的管理区域中有一个视图,允许我查看所有用户.
I have a Laravel 5.4 application and I have a view in my admin area that allows me to see all users.
我想创建一个允许我单击后端中的按钮的功能,该功能可以自动执行发送默认Laravel密码重置功能的过程.
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.
在我看来,我有以下内容:
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);
}
我不熟悉Laravels的默认密码重置功能,因此可能还很遥远,但出现以下错误:
I'm not to familiar with Laravels default password reset functionality so I'm probably way off but I get the following error:
参数1传递给 Illuminate \ Auth \ Passwords \ PasswordBroker :: sendResetLink()必须为 类型数组,给定的字符串,
Argument 1 passed to Illuminate\Auth\Passwords\PasswordBroker::sendResetLink() must be of the type array, string given,
推荐答案
您需要发送一个以email
作为键的数组:
You need to send an array with email
as key:
Password::sendResetLink(['email' => $user->email]);
这篇关于Laravel 5.4密码重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!