Skip to content

Commit 9086685

Browse files
committed
Update readme
1 parent 528fd8c commit 9086685

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ request()->validate([
7676
'model_id' => RouteKeyExists::model(Model::class)->replace(),
7777
]);
7878

79-
$id = request('model_id');
79+
$id = request('model_id'); // actual ID
8080
```
8181

8282
If your form uses a different attribute name than your model or database, you can replace the ID and the attribute name in the process.
@@ -97,10 +97,11 @@ request()->validate([
9797
'model_id' => RouteKeyExists::model(Model::class)->add('actual_id'),
9898
]);
9999

100-
$id = request('actual_id');
100+
$id = request('actual_id'); // actual ID
101+
$key = request('model_id'); // route key
101102
```
102103

103-
Beware that `actual_id` is not included on the `$attributes` array, since it is not being validated.
104+
Beware that attributes that are dynamically added to the request will not be included in the array that is returned from `request()->validate()`. You can access those via `request('attribute_name')`.
104105

105106
## Useful Packages
106107

0 commit comments

Comments
 (0)