On this page
ConditionalRules
class ConditionalRules (View source)
Properties
protected callable|bool | $condition | The boolean condition indicating if the rules should be added to the attribute. |
|
protected array|string|Closure | $rules | The rules to be added to the attribute. |
|
protected array|string|Closure | $defaultRules | The rules to be added to the attribute if the condition fails. |
Methods
void | __construct(callable|bool $condition, array|string|Closure $rules, array|string|Closure $defaultRules = []) Create a new conditional rules instance. |
|
bool | passes(array $data = []) Determine if the conditional rules should be added. |
|
array | rules(array $data = []) Get the rules. |
|
array | defaultRules(array $data = []) Get the default rules. |
Details
void __construct(callable|bool $condition, array|string|Closure $rules, array|string|Closure $defaultRules = [])
Create a new conditional rules instance.
bool passes(array $data = [])
Determine if the conditional rules should be added.
array rules(array $data = [])
Get the rules.
array defaultRules(array $data = [])
Get the default rules.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Validation/ConditionalRules.html