From 370311db54f5491269f6d5e69dd097a2bfba512a Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Mon, 11 May 2020 11:17:00 +0800 Subject: [PATCH] simplify --- app/Models/Concerns/HasPassword.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/app/Models/Concerns/HasPassword.php b/app/Models/Concerns/HasPassword.php index 7c27054c..f0cb1781 100644 --- a/app/Models/Concerns/HasPassword.php +++ b/app/Models/Concerns/HasPassword.php @@ -7,7 +7,7 @@ use Illuminate\Support\Arr; trait HasPassword { - public function verifyPassword($raw) + public function verifyPassword(string $raw) { // Compare directly if any responses is returned by event dispatcher if ($result = $this->getEncryptedPwdFromEvent($raw, $this)) { @@ -19,26 +19,15 @@ trait HasPassword /** * Try to get encrypted password from event dispatcher. - * - * @param string $raw - * - * @return mixed */ - public function getEncryptedPwdFromEvent($raw) + public function getEncryptedPwdFromEvent(string $raw) { $responses = event(new EncryptUserPassword($raw, $this)); return Arr::get($responses, 0); } - /** - * Change password of the user. - * - * @param string $password new password that will be set - * - * @return bool - */ - public function changePassword($password) + public function changePassword(string $password): bool { $responses = event(new EncryptUserPassword($password, $this)); $hash = Arr::get($responses, 0);