From da26a1a9b0e55c6619ef7bcfdb5c903bc10ff67d Mon Sep 17 00:00:00 2001 From: Mark van Eijk Date: Mon, 21 Oct 2019 11:27:57 +0200 Subject: [PATCH] Added documentation for prepareForValidation method --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 71c3b2c..00796c3 100644 --- a/README.md +++ b/README.md @@ -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.