Closed andrey900 closed 8 years ago
There is no way to change the Action of a Route once it has been created.
Reference: https://github.com/slimphp/Slim/blob/3.x/Slim/Route.php Getter no Setter.
No, but you can update the route in middleware before the action is determined.
But why would you need to? Just register multiple routes (one for each switch case in your example)
I generate routes on the fly from a database, but I want to be able to change the default behavior of the controller, depending on a URL. I thought that there will use middleware. I'll try use, the pattern strategy for the controller.
I think @JoeBengalen answer is a solution to your issue. Closing this issue for that reason. Please reopen if you feel its not resolved.
Can you tell, and if I could change the controller or method used by default when you go middleware? Example: