How to Manually Trigger a Password Reset Email in Laravel 5
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)
{
$this->sendResetLinkEmail($request);
// 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>
</form>
Then all you need is a route
Route::put('users/{id}/reset-password', 'Users@resetPassword');