title: Is it possible to inject a repository as a dependency in a laravel service file?
body: <p>What I am trying to do -
  1) Controller will depend on service for logic and stuff.
  2) Service with depend on repository for database access.
  3) Controller will get service as a dependency.
  4) Service will get a repository as a dependency.</p>
  
  <p>My service class is - </p>
  
  <pre><code>class AnimeService implements IAnimeService{
  
      protected $animeRepository;
  
      public function _construct(IAnimeRepository $_animeRepository) {       
          $this-&gt;animeRepository = $_animeRepository;
      }
  
      public function add(Anime $anime) {      
          return $this-&gt;animeRepository-&gt;add($anime);
      }
  }
  </code></pre>
  
  <p>problem is - </p>
  
  <pre><code>Call to a member function add() on null
  </code></pre>
  
  <p>which is expected - as the _construct is never being called. </p>
  
  <p>By the way; from my AppServiceProvider </p>
  
  <pre><code>public function register()
      {
          $this-&gt;app-&gt;bind('\App\Services\Interfaces\IAnimeService', '\App\Services\Implementations\AnimeService');
          $this-&gt;app-&gt;bind('\App\Repositories\Interfaces\IAnimeRepository', '\App\Repositories\Implementations\AnimeRepository');
      }
  </code></pre>
  
  <p>My questions are -
  1) What can I do in this situation to make my service work?</p>
  
  <p>2) What is the best practice?</p>
  
  <p>3) What other ways are there to achieve what I am trying to do?</p>
  
  <p>Thank you. </p>