title: Interface laravel doesn't bind why?
body: <p>Hello guys I was creating a package and i was trying to implement a dependency injection on my class without success. I followed all the instruction for do it work. I'm getting crazy on it.
  When i try to call </p>
  
  <pre><code>Player::team_players(2);
  </code></pre>
  
  <p>it throw me an error:</p>
  
  <blockquote>
    <p>Argument 1 passed to Team\Player\Player::__construct() must be an
    instance of Team\Player\StatusPlayerInterface, none given, called in
    C:\wamp\www\ultima\workbench\team\player\src\Team\Player\PlayerServiceProvider.php
    on line 35 and defined</p>
  </blockquote>
  
  <p><strong>I created my class Player.php</strong></p>
  
  <pre><code>&lt;?php namespace Team\Player;
  
  use Team\Player\Models\User;
  use Team\Player\Models\Team;
  use Team\Player\Models\Fighter;
  use Team\Player\StatusPlayerInterface;
  use DB;
  
  class Player {
  
    protected $player;
  
    function __construct(StatusPlayerInterface $player) {
      $this-&gt;player = $player;
    } 
  
    public function team_players($team_id) {
      return $player-&gt;team($team_id);
    }
  }
  </code></pre>
  
  <p><strong>StatusPlayerInterface.php</strong></p>
  
  <pre><code>&lt;?php namespace Team\Player;
  
  interface StatusPlayerInterface {
  
      public function team($team_id); // active - retired - injured by team id
  
  }
  </code></pre>
  
  <p><strong>Active.php</strong></p>
  
  <pre><code>&lt;?php namespace Team\Player;
  
  use Team\Player\Models\User;
  use Team\Player\Models\Team;
  use Team\Player\Models\Fighter;
  
  /**
  * 
  */
  class Active implements StatusPlayerInterface
  {
  
      protected $user;
      protected $team;
      protected $fighter;
  
      function __construct(User $user,Team $team,Fighter $fighter)
      {
          $this-&gt;user = $user;
          $this-&gt;team = $team;
          $this-&gt;fighter = $fighter;
      }
  
      public function team($team_id) 
      {
          return $fighters = $this-&gt;fighter-&gt;with('user')-&gt;where('team_id',$team_id)-&gt;active()-&gt;Confirmed()-&gt;get();
      }
  
  }
  </code></pre>
  
  <p><strong>PlayerServiceProvider.php</strong></p>
  
  <pre><code>public function register()
      {
  
           $this-&gt;app-&gt;bind('Team\Player\StatusPlayerInterface','Team\Player\Player'); // bind the interface
           $this-&gt;app['player'] = $this-&gt;app-&gt;share(function($app)
            {
              return new Player; // line 35
            });
  
           $this-&gt;app-&gt;booting(function()
          {
            $loader = \Illuminate\Foundation\AliasLoader::getInstance();
            $loader-&gt;alias('Player', 'Team\Player\Facades\Player');
          });
      }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>What i'm trying to do is to follow a principle that Jeffrey Way suggested to follow. It say
  Entities should be open for extension but close for modification.</p>
  
  <p>I 2 others classes that implements StatusPlayerInterface and of course change only the query on the function team()</p>
  
  <ul>
  <li>Active // on the example</li>
  <li>Retired </li>
  <li>Injured</li>
  </ul>
  
  <p>Then i have the main class <strong>Player</strong> and with the method <strong>team_players</strong> it should automatically call the function team of the instance called. this method is used for don't do</p>
  
  <pre><code>class Player {
  
   ....
  
    function team_player($team_id,$status) {
        if (is_a($status) == "Active") {
            $fighters = $this-&gt;fighter-&gt;with('user')-&gt;where('team_id',$team_id)-&gt;active()-&gt;Confirmed()-&gt;get();
        } elseif(is_a($status) == "Retired") {
             $fighters = $this-&gt;fighter-&gt;with('user')-&gt;where('team_id',$team_id)-&gt;retired()-&gt;Confirmed()-&gt;get();
        } 
     // ecc
    }
  
  }
  </code></pre>
  
  <p>but i can throw pass the interface to the constructor and return just the function team of the interface, because the interface is like a contract so it can trust that exist that function. But the problem is that i cannot find a way for pass that interface on the constructor.</p>