mardi 28 mars 2017

Call form request from controller based on request input

I have a controller that accepts input. This input is parsed by a request validation (POSRequest). If the request validation succeeded, the request is then passed into the controller. Standard laravel stuff.

I have to typehint in the controller POSRequest $requests in order to fire the request validation, how can I call other requests based on the input provided in POSRequest $request?

Here is some code to clear things up a bit:
public function process(POSRequest $request){ ... }

All of my requests come to process function and based on input of $requests i need to call other functions:
private function StartRequest(POSStartRequest $request) { ... }
private function CheckRequest(POSCheckRequest $request) { ... }

How can i call these frunctions from within the controller from within the process function and convert POSRequest to either one of other requests?

Thank you in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire