Unresolvable dependency resolving [Parameter #0 [ $name ]]

后端 未结 3 1601
南方客
南方客 2020-12-11 00:23

Warning: This question is Laravel 4 specific.

I\'ve been using Facades in my controllers before. Therefore I know the code is working. Now I need to

3条回答
  •  温柔的废话
    2020-12-11 00:48

    Got it fixed. All the tutorials about dependency injection were referring to concrete implementations of interfaces so that I thought that's the way to go about it. Joseph Silber's answer got me on the right track.

    The trick is to bind the Interface to the binding of the ServiceProvider like shown below. That way Laravel will know how to instantiate the Helpers service.

    File: app/start/global.php

提交回复
热议问题