Skip to content

Commit fda7091

Browse files
committed
Update documentation
1 parent 52e3e81 commit fda7091

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/validation/introduction.md

+22
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,28 @@ class SongData extends Data
132132
}
133133
```
134134

135+
The above example will override the automatically inferred rules. If you want the manual rules to be merged with the automatically inferred rules, you can use the `MergeRules` attribute:
136+
137+
```php
138+
#[MergeRules]
139+
class SongData extends Data
140+
{
141+
public function __construct(
142+
public string $title,
143+
public string $artist,
144+
) {
145+
}
146+
147+
public static function rules(): array
148+
{
149+
return [
150+
'title' => ['max:255'],
151+
'artist' => ['max:255'],
152+
];
153+
}
154+
}
155+
```
156+
135157
You can read more about manual rules in its [dedicated chapter](/docs/laravel-data/v4/validation/manual-rules).
136158

137159
### Using the container

0 commit comments

Comments
 (0)