How do I perform dependency injection in Laravel?

devquora
devquora

Posted On: Jun 18, 2021

 

You can perform dependency injection in Laravel with the help of the given step:

  • public function __construct(Request $request)
  • composer create-project laravel/laravel DI --prefer-dist.
  • DB_CONNECTION=mysql DB_HOST=127.0. 0.1 DB_PORT=3306 DB_DATABASE=di DB_USERNAME=root DB_PASSWORD=mysql.
  • php artisan make:seeder UsersTableSeeder.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Laravel Latest Questions

    Explain what is Laravel

    Laravel is an open-source and free PHP framework. This means that this framework can be used for any purpose and the users can study it and modify or make changes in it as well. It is a web framework ...

    Laravel Latest Questions

    How do I install Laravel, talk about the different ways?

    You can download laravel by first downloading the Laravel installer using Composer: composer global requires "laravel/installer=~1.1" then place the ~/.composer/vendor/bin directory in your PATH so th...

    Laravel Latest Questions

    Explain what is MVC architecture?

    MVC architecture stands for Model-View-Controller architecture which is an architectural pattern that separates an application into three main logical components: the model, the view, and the controll...