Tuesday, March 14, 2017

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.

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></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td><a href="/admin/user//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:

Argument 1 passed to Illuminate\Auth\Passwords\PasswordBroker::sendResetLink() must be of the type array, string given,



via Dev.Wol

Advertisement