Password
class Password implements Rule, DataAwareRule, ValidatorAwareRule (View source)
Traits
Properties
protected Validator | $validator | The validator performing the validation. |
|
protected array | $data | The data under validation. |
|
protected int | $min | The minimum size of the password. |
|
protected int | $max | The maximum size of the password. |
|
protected bool | $mixedCase | If the password requires at least one uppercase and one lowercase letter. |
|
protected bool | $letters | If the password requires at least one letter. |
|
protected bool | $numbers | If the password requires at least one number. |
|
protected bool | $symbols | If the password requires at least one symbol. |
|
protected bool | $uncompromised | If the password should not have been compromised in data leaks. |
|
protected int | $compromisedThreshold | The number of times a password can appear in data leaks before being considered compromised. |
|
protected array | $customRules | Additional validation rules that should be merged into the default rules during validation. |
|
protected array | $messages | The failure messages, if any. |
|
static string|array|callable|null | $defaultCallback | The callback that will generate the "default" version of the password rule. |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Create a new rule instance.
Get the default configuration of the password rule and mark the field as required.
Get the default configuration of the password rule and mark the field as sometimes being required.
Set the data under validation.
Set the minimum size of the password.
Set the maximum size of the password.
Ensures the password has not been compromised in data leaks.
Makes the password require at least one uppercase and one lowercase letter.
Makes the password require at least one letter.
Makes the password require at least one number.
Makes the password require at least one symbol.
Determine if the validation rule passes.
Get the validation error message.
Adds the given failures, and return false.
Details
$this|TWhenReturnType
when($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
$this|TUnlessReturnType
unless($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
static Password|void
defaults(Password|callable|null $callback = null)
Set the default callback to be used for determining a password's default rules.
If no arguments are passed, the default password rule configuration will be returned.
static array
required()
Get the default configuration of the password rule and mark the field as required.
static array
sometimes()
Get the default configuration of the password rule and mark the field as sometimes being required.
$this
uncompromised(int $threshold = 0)
Ensures the password has not been compromised in data leaks.
$this
rules(Closure|string|array $rules)
Specify additional validation rules that should be merged with the default rules during validation.