내 암호 미리 알림 동작 방식을 변경하고 싶습니다. Laravel에서 사용자가 암호를 재설정하면 토큰과 함께 password_reminders 테이블에 만들어진 행이 삭제됩니다. 다른 것들을 할 수 있기를 원합니다. 내가 알고 싶은 것은 그 행동을 확장하는 방법이다.Laravel 암호 수정 알림 동작 (암호 변경 행을 삭제하지 않음)
가 PasswordBroker의 reset 메소드는 다음과 같다 :
$response = Password::reset($credentials, function($user, $password)
{
$user->password = Hash::make($password);
$user->save();
});
(를 분명히/인증/알림/PasswordBroker.php)
public function reset(array $credentials, Closure $callback)
{
// If the responses from the validate method is not a user instance, we will
// assume that it is a redirect and simply return it from this method and
// the user is properly redirected having an error message on the post.
$user = $this->validateReset($credentials);
if (! $user instanceof RemindableInterface)
{
return $user;
}
$pass = $credentials['password'];
// Once we have called this callback, we will remove this token row from the
// table and return the response from this callback so the user gets sent
// to the destination given by the developers from the callback return.
call_user_func($callback, $user, $pass);
$this->reminders->delete($credentials['token']);
return self::PASSWORD_RESET;
}
지금 내 RemindersController에서 나는 외관 비밀번호를 호출 actullay입니다 PasswordBroker의 확장을 만들고 내 컨트롤러에서 호출하려면 어떻게합니까? 새로운 서비스 제공자도 만들어야합니까? PasswordBroker를 확장하는 새로운 클래스를 작성하고, ReminderServiceProvider와 새로운 Facade를 확장하는 새 서비스 제공자를 작성하고 컨트롤러에 새 Facade의 새 메소드를 호출하십시오. 그게 적절한 방법인가요?
passwordbroker.php를 확장하는 클래스를 만들고, reset 메소드를 가지고 있으며, 확장 클래스/메소드를 namespacing driectly라고 부르면됩니까? Facades를 통과 할 필요가 없습니까? 그것은 애플 리케이션 차원에서 사용할 수있는 것이 좋을 것입니다, 그래서 내가 어떻게 할 것인가? 그 클래스를 만들고 봇을 서비스 제공 업체와 그 외관을 만드시겠습니까? –
위의 답변을 업데이트했습니다. – carousel
그렇게 쉽게 설명 할 수 있습니다. 나는 그에게 갈증을 줄 것이다. –