type = $type; $this->password = $password; $this->totp = $totp; $this->pending_error = $pending_error; } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value) { if ($this->type == 'manual') { $email = $value; $password = $this->password; if (Auth::guard('user')->attempt(['email' => $email, 'password' => $password])) { $data = User:: where('email', $email) ->whereIn('status', [1, 9]) ->count(); if (!$data) { return false; } return true; } } } /** * Get the validation error message. * * @return string */ public function message() { if (!$this->pending_error) { return config('error_code.login_error'); } else { return config('error_code.pending_error'); } } }