I want to access a controller name-space using the parameter in a route URL. Is something like this possible?
Route::group(['namespace' => 'My\Name\Space\{clientId}\Controllers', 'middleware' => 'api'], function () {
Route::get('api/v1/clients/{clientId}/test', 'TestController@test');
});
So
api/v1/clients/example/test
Would load the TestController
class with namespace My\Name\Space\example\Controllers
running method test
Since I am using laravel (and writing a package - so using a ServiceProvider) I would think there is somewhere I could hook in / override (and manipulate) the url parameter before the logic for deciding the controllers and controller methods are assigned.
I wish to do this with quite a few routes.