Ilyas Foo
Ilyas Foo

Reputation: 134

Trigger Laravel 5.4 reset password programatically from controller

I need to use Laravel's out-of-the-box reset password functionality through another function in my API controller.

Upvotes: 0

Views: 597

Answers (1)

Ilyas Foo
Ilyas Foo

Reputation: 134

Use the ResetPasswords trait in your controller.

class ApiController extends Controller 
{
    use \Illuminate\Foundation\Auth\ResetsPasswords;

    public function doSomething(Request $request) {
        ...
        $this->broker()->sendResetLink(['email' => '[email protected]']);
    }
}

Upvotes: 6

Related Questions