Martin Carlin

How to Manually Trigger a Password Reset Email in Laravel 5

in laravel

I've been trying to figure this out for a while before I cracked it:

Users Controller

use Illuminate\Foundation\Auth\SendsPasswordResetEmails;

class Users extends Controller

    use SendsPasswordResetEmails;

    public function resetPassword(Request $request, $id)

        // your response

The form I used in my view is

<form id="password-reset-form" action="/users/{{ $user->id }}/reset-password" method="put">
   {{ csrf_field() }}
   <input type="hidden" name="_method" value="put">
   <input type="hidden" name="email" value="{{ $user->email }}">
   <button type="submit">Reset Password</button>

Then all you need is a route

Route::put('users/{id}/reset-password', '[email protected]');
comments powered by Disqus