You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some rules like `min`, `max`, `between`, `match`, `contains`, `in` and `regex` require additional parameters. You can pass these parameters to the rules by separating them with a colon (`:`).
152
152
153
153
```php{2}
154
-
form()->validate($data, [
154
+
request()->validate([
155
155
'bio' => 'min:10',
156
156
]);
157
157
```
158
158
159
159
Some rules like `between` and `in` require multiple parameters. You can pass these parameters by using an array.
160
160
161
161
```php{2}
162
-
form()->validate($data, [
162
+
request()->validate([
163
163
'bio' => 'between:[18,30]',
164
164
]);
165
165
```
@@ -175,7 +175,7 @@ You can create your own rules using the `addRule()` method or it's alias `rule()
175
175
::: code-group
176
176
177
177
```php [Regular Expression]
178
-
request()->form()->rule('isEven', '/^\d*[02468]$/', '{field} must be even.');
178
+
request()->validator()->rule('isEven', '/^\d*[02468]$/', '{field} must be even.');
Sometimes, you may want to validate data that does not come from the request object. You can do this by accessing the `Leaf\Form` class directly. We have a `form()` shortcut that returns the validator instance.
0 commit comments