I have a custom request class which is getting longer and longer with project development.
An API endpoint is expected to have multiple types ofinput. Any one is expected to be received at once.
According to the input, the validation rules are being constructed.
Right now I am having a long list of swith-cases to construct validation rules.
I want to create multiple requests classes for each case and dynamically inject appropriate request class to the controller method. Note that I cannot create multiple api endpoints.
/**
* Get the sub class name with namespace
* @return string
*/
public function getRequestClass()
{
return '\<path>\<to\<namespace>\' . studly_case($this->resourceType) . 'Request';
}