Add parameter in request from Rules
Hello,
I would like to know if it is possible to add a parameter in request from a rule validation file.
Because in my rule, i make some sql requests but i need to do the same requests after the validation to get a parameter.
Maybe is it possible to prevent to do the sql requests twice and simply add the parameter that i got in my rule validation ?
Thanks
Just cache the result - adding to the Request (while possible) is messy.
You can cache for the duration of the current Request if you use the array driver, e.g.
\Cache::driver('array')
->rememberForever('key', fn() => Model::where('something', $request->input('some_key))->first());
You can fetch the cached data from the Cache elsewhere.
Please or to participate in this conversation.