On this page
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 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
$this|TWhenReturnType | when($value = null, callable $callback = null, callable $default = null) Apply the callback if the given "value" is (or resolves to) truthy. |
from Conditionable |
$this|TUnlessReturnType | unless($value = null, callable $callback = null, callable $default = null) Apply the callback if the given "value" is (or resolves to) falsy. |
from Conditionable |
void | __construct(int $min) Create a new rule instance. |
|
static Password|null | defaults(Password|callable|null $callback = null) Set the default callback to be used for determining a password's default rules. |
|
static Password | default() Get the default configuration of the password rule. |
|
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 | setValidator(Validator $validator) Set the performing validator. |
|
$this | setData(array $data) Set the data under validation. |
|
static $this | min(int $size) Sets the minimum size of the password. |
|
$this | uncompromised(int $threshold = 0) Ensures the password has not been compromised in data leaks. |
|
$this | mixedCase() Makes the password require at least one uppercase and one lowercase letter. |
|
$this | letters() Makes the password require at least one letter. |
|
$this | numbers() Makes the password require at least one number. |
|
$this | symbols() Makes the password require at least one symbol. |
|
$this | rules(string|array $rules) Specify additional validation rules that should be merged with the default rules during validation. |
|
bool | passes(string $attribute, mixed $value) Determine if the validation rule passes. |
|
string|array | message() Get the validation error message. |
|
string | getErrorMessage(string $key) Get the translated password error message. |
|
bool | fail(array|string $messages) Adds the given failures, and return false. |
Details
$this|TWhenReturnType when($value = null, callable $callback = null, callable $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
$this|TUnlessReturnType unless($value = null, callable $callback = null, callable $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
void __construct(int $min)
Create a new rule instance.
static Password|null 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 Password default()
Get the default configuration of the password rule.
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 setValidator(Validator $validator)
Set the performing validator.
$this setData(array $data)
Set the data under validation.
static $this min(int $size)
Sets the minimum size of the password.
$this uncompromised(int $threshold = 0)
Ensures the password has not been compromised in data leaks.
$this mixedCase()
Makes the password require at least one uppercase and one lowercase letter.
$this letters()
Makes the password require at least one letter.
$this numbers()
Makes the password require at least one number.
$this symbols()
Makes the password require at least one symbol.
$this rules(string|array $rules)
Specify additional validation rules that should be merged with the default rules during validation.
bool passes(string $attribute, mixed $value)
Determine if the validation rule passes.
string|array message()
Get the validation error message.
protected string getErrorMessage(string $key)
Get the translated password error message.
protected bool fail(array|string $messages)
Adds the given failures, and return false.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Validation/Rules/Password.html