I've been working on resetting password but using a custom notification instead of Laravel notification. This is the file vendor\laravel\framework\src\Illuminate\Auth\Passwords\CanResetPassword.php
public function sendPasswordResetNotification($token)
{
//use custom notification to change the url instead of modifying the original class
//$this->notify(new ResetPasswordNotification($token));
$this->notify(new CustomResetPassword($token));
}
That's ow I call it in a service class
$reset_password_status = Password::reset($credentials, function ($user, $password) {
$user->password = $password;
$user->save();
});
if ($reset_password_status == Password::INVALID_TOKEN) {
return $this->returnError->error("Invalid token provided");
}
But the problem is building the project online is done automatically and run composer install every time and can't just upload the change manually so I'm looking for a way to override this function in my code to reset the password instead of editing CanResetPassword.php
file which exists in the vendor folder
On your Class
that is using this trait you can override this function. Every function written in class have priority over trait function.