8 months ago

Manually calling passing data to a form validator in a controller

Posted 8 months ago by drewdan

Hi guys, I have two methods in my controller, which are pretty similar, however the one has a form request validator which looks like:

    public function translate(Interaction $interaction, InteractionTranslateRequest $request): Response {

and the second one does not:

    public function autoTranslate(Interaction $interaction): Response {

The translate function accepts a language code which is validated in the InteractionTranslateRequest. The second one does a lookup for that language code based on the content of the interaction model, however, I would like to use this language code to call the translate function on the method and then run the form validation against the lanuage code detected in the autoTranslate method.

I tried newing up the InteractionTranslateRequest, but it seems to be missing some server params, so I am not sure how I get around that. Any ideas guys?

Thanks, Andrew

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