adspace
Tell me how do you do dependency injection in laravel?
Answer Posted / Uttam Kumar
"Dependency Injection is accomplished in Laravel through the use of the service container. To bind a class as a service, you can utilize the IoC container with the `bind`, `singleton`, or `instance` methods. For example:nn<code>// Bind a class as a singletonn$app->singleton('AppServicesMyService', function () {n return new AppServicesMyService();n});</code>"
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers