DEV Community

Discussion on: Service container in Laravel

Collapse
c0d3b0t profile image
Senik Hakobyan

In simple words: whenever you define a parameter in your class constructor - you define a dependency for that class, so that it can't be initialized without injecting (passing) dependencies that you have required in your constructor.

Laravel does it for you automatically unless you are not injecting abstractions, like interfaces. In those cases you can implement bindings in Service Providers.

Good luck! :)

Collapse
sobirjonovs profile image
Sanjarbek Sobirjonov Author

Thank you!!! Got it!