Assume I have routes:
/list/{bar}
/{foo}/list/{bar}
Where the second is more specific. And I have two controllers, BarController and FooBarController, where the latter extends the former for shared functionality.
Now, my understanding the route parameters is that they are passed to controller methods in the order they appear in the ULR parameters i.e.
for FooBarController@edit the method will look like this:
function edit($foo_param, $bar_param)
what I'd like to do is have this edit method declared in the parent BarControlller only, but that requires something like this:
function edit($foo_param = null, $bar_param)
which won't work - because of the order the parameters, $foo_param will never be null. What I want to do is flip the order of the parameters, so I have behaviour like this:
function edit($bar_param, $foo_param = null)
without changing the URL format.
Is it possible to manipulate the variables before sending them to the controller? Perhaps with a closure or something?
Thanks!