RFFRED
3 months ago
190
3
Laravel

Accessing $request->validated() from a model

Posted 3 months ago by RFFRED

Hi

I don't seem to be able to do this from a model when submitting a form

$request = request(); //works
$validatedData = $request->validated(); //fails

My form requires several external modules which have their own saving mechanism. I would like the modules to have access to the $request->validated() function to get the submitted data.

The error I receive is:

Method Illuminate\Http\Request::validated does not exist.

I ended up passing the validated data as a function parameter but I would rather not

Please sign in or create an account to participate in this conversation.