rappasoft
4 years ago

How do you pass constructor parameters when you're instantiating an interface through a bind?

Posted 4 years ago by rappasoft

I have an interface for database operations. I have classes that can bind to it, such as Eloquent, Sphinx, etc.

So say the EloquentRepository/SphinxRepository have a constructor with the dependency.

If I do:

$this->app->bind( 'MasterUploader', 'EloquentUploader' );

How do I instantiate the interface and pass in the dependency that the bind needs?

Is it App::make("MasterUploader", $constructorDependencies)?

Little confused with this method.

Please sign in or create an account to participate in this conversation.