target = $target; } public static function handle(): string { return 'zxcvbn'; } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * * @return bool */ public function passes($attribute, $value) { $zxcvbn = (new ZxcvbnPhp())->passwordStrength($value); return ($zxcvbn['score'] >= $this->target); } /** * Get the validation error message. * * @return string */ public function message() { return 'The :attribute is not strong enough.'; } }