I know this is kind of a sin, but I don't have any code to show, it is just that I completely hit a brick wall. My problem is the following.
I have a client that connects to a Lumen/Dingo Api. For all the requests it works great. For example:
My route:
$api->get('contact', 'ContactController@get');
Coupled with this I have a ContactController
and inside I have a get
function that returns a response. No problem here.
Now the following problem:
I have a route with tasks:
$api->get('task/{id}', 'TaskController@get');
The problem is that in the system not all the Tasks
are the same. Depending on the Type
of task I want to perform special actions. I was thinking of creating a new Controller
for each Task
. Like MySpecialTask1Controller
, MySpecialTask2Controller
and from my main TaskController
I redirect to another controller.
Problem is 1) I do not know how to do this, and 2) I do not know if this would be the best way to do this.
Maybe this problem can be solved with services or other tools Dingo/Lumen provide. Maybe someone can help me out on this.