Well, code describes it all. I've an Entity Service Provider, which pass an instance of Playlist Model, which supposed to get an array as it's first constructor parameter. How to pass that parameter through app->bind? Knowing that EntityServiceProvider is automagically injected when referenced in the controller.
// Current Code
/**
* Playlist Entity
*
* @return Playlist\PlaylistEntity
*/
$this->app->bind('Playlist\PlaylistEntity', function($app)
{
return new PlaylistEntity($app->make('Playlist\PlaylistRepositoryInterface'));
});
// Should be something like this:
/**
* Playlist Entity
*
* @return Playlist\PlaylistEntity
*/
$this->app->bind('Playlist\PlaylistEntity', function($app)
{
return new PlaylistEntity($app->make('Playlist\PlaylistRepositoryInterface', $parameters));
});
Similar case: Laravel 4: Passing data from make to the service provider
Alex Russell's comment works for me as well.
The answer in the 'similar case' post is correct as far as I can tell.
$this->app->bind('Whatever', function ($app, $params) { var_dump($params); });
followed byApp::make('Whatever', [1, 2, 3]);
var_dumps the[1, 2, 3]
array for me.