-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Labels
Description
I have a situation where I have a interface that a class in each module need to implement, I don't have a default module, so, my idea is to only use the contextual binding, see code:
$this->app->when('ModuleXController')
->needs('GlobalXContract')
->give('ConcretClassModuleX');But I'm facing the Target GlobalXContract is not instantiable while building ModuleXController
This works when I do something like:
$this->app->bind('GlobalXContract', 'ConcretClassDefault');
$this->app->when('ModuleXController')
->needs('GlobalXContract')
->give('ConcretClassModuleX');My question is, is it not more interesting to make optional the default binding when using contextual binding ?
Regards.