Dependency Injection and the container - Examples in Laravel

Поделиться
HTML-код
  • Опубликовано: 23 сен 2024
  • 👨‍💻 Check out the discounted, early-release version of my test-driven development course: tddwithlaravel...
    Twitter: / mateusjatenee

Комментарии • 19

  • @favourgabriel750
    @favourgabriel750 6 месяцев назад

    Thank you so much, this was very helpful. It clearified my confusion with service containers.

  • @teddyperera8531
    @teddyperera8531 4 года назад +1

    I just found this gem video. I was looking to understand how all these functionalities come to laravel. Lucky I found this video and understand it's all from laravel container via dependency injection.
    huge thank to you!

    •  4 года назад +1

      Teddy Perera Hey Teddy.
      Thanks so much for leaving a comment. I really, really appreciate it. ❤️

  • @daltonyon
    @daltonyon 3 года назад +1

    Nice explanation 👌

  • @brazenbull36
    @brazenbull36 4 года назад

    I just found your channel. Looks like you have some important deep dive topics covered.

    •  4 года назад

      Thank you.

  • @marcosadriano5861
    @marcosadriano5861 3 года назад +1

    This video makes me feel like everything I thought I knew was wrong

  • @blank001
    @blank001 4 года назад

    Nice and informative video, could you increase the sound volume and decrease the noise. Other than that it's great.

    •  4 года назад

      Hey Ram, the newer videos should have better audio quality. Thanks!

  • @TheSathivel
    @TheSathivel 3 года назад

    Could you please explain how can I achieve for the following in laravel 8 . 1. Dependency Injection - Use dependency injection for locating controllers for Development and production environment. 2. Dependency Injection - for setting parameters for the Dev and Production environment.

  • @kyrilcouda
    @kyrilcouda 4 года назад +1

    Saved me, thanks.

    •  4 года назад

      Glad you liked it

  • @jalipenorunner
    @jalipenorunner 5 лет назад +1

    this is pretty good

  • @MCleonell
    @MCleonell 4 года назад +1

    You could also do the if else statement inside of the bind function like this:
    app()->bind(Gateway::class, function($app) {
    if(country == 'us'){
    return new StripeGateway();
    } else {
    return new PaypalGateway();
    }
    });

  • @Askbowe
    @Askbowe 5 лет назад

    I just need to understand one thing... where in laravel is the app () function declared?? It seems it's an alias to Applications class .. please explain to me how it is called

    •  5 лет назад +1

      It's a default helper on Laravel. It just returns the Container instance when called without params.

    • @Askbowe
      @Askbowe 5 лет назад +1

      @ thank you I now understand

  • @guilleagudelo
    @guilleagudelo 5 лет назад

    solid, thanks

  • @777Vasya77
    @777Vasya77 5 лет назад

    nice! thanks!