Skip to content

Commit

Permalink
Merge pull request #25 from markvaneijk/patch-1
Browse files Browse the repository at this point in the history
Added documentation for prepareForValidation method
  • Loading branch information
lorisleiva authored Oct 21, 2019
2 parents 9c99635 + da26a1a commit 96f4bbf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ public function asController(Request $request)
}
```

If you want to prepare the data before running the action (and thus also before validating the data), you can use the `prepareForValidation` method. Which follows the same naming convention within a FormRequest in Laravel.

It is worth noting that, just like the `handle` method, the before hooks [support dependency injections](#dependency-injections) .

Also note that these before hooks will be called right before the `handle` method is executed and not when the action is being created. This means you cannot use the `asController` method to register your middleware. You need to [use the `register` method](#registering-middleware) instead.
Expand Down

0 comments on commit 96f4bbf

Please sign in to comment.