I would like to find a good way to pass a pre-configured object to a controller. I know that I can use the IoC like below:
Mycontroller extends extends \Illuminate\Routing\Controllers\Controller {
//i can only use one config uless i pass Request data
$this->config = App::make('MyconfigObject');
}
but this seems to have the limitation of only being able to use one config. I would rather do something like the following:
Route::get('some-route', function()
{
$config = Config::get('some.config');
$object = new MyConfigObject($config);
Route::dispatch(MyController($object));
});
The reason I would like to do this is that I would like to dispatch the same controller, but with different configuration for several routes.