Reputation: 317
I'm trying to reuse the reset password in Laravel (Illuminate\Foundation\Auth\SendsPasswordResetEmails) to a form that I'm using.
Controller
public function resetPassword($id)
{
$user = DB::table('users')->where('id', $id)->first();
SendsPasswordResetEmails::sendResetLinkEmail($user->email);
return back()->with('success', 'Password has been sent on email.');
}
The error I'm getting:
Non-static method Illuminate\Foundation\Auth\SendsPasswordResetEmails::sendResetLinkEmail() should not be called statically
Upvotes: 0
Views: 470
Reputation: 2104
As error showing, you should not call static way for sendResetLinkEmail
function. You can use below code:
public function resetPassword($id)
{
$user = DB::table('users')->where('id', $id)->first();
$sendResetObject = new SendsPasswordResetEmails();
$sendResetObject->sendResetLinkEmail($user->email);
return back()->with('success', 'Password has been sent on email.');
}
Hope it helps you.
Upvotes: 1