crmCustomer = $crmCustomer; } /** * Determine if the validation rule passes. * * @param mixed $attribute * @param mixed $value * @return boolean * @throws \LDC\LDCCRM\Exceptions\ApiErrorException If any unhandled error occurs. * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed */ public function passes($attribute, $value) { // phpcs:enable try { return Customer::login($this->crmCustomer->email, strval($value)); } catch (ApiErrorException $e) { if ($e->getApiError()->equals(ApiError::authFailed)) { return false; } throw $e; } // Pass. return true; } /** * Get the validation error message. * * @return string */ public function message() { return trans('Votre ancien mot de passe n\'as pu être vérifié'); } }