title: Laravel: calling controller method from another location
body: <p>In my Laravel app I have the following controller that takes the instance of Elastic search as a first parameter and then another variable:</p>
  
  <pre><code>use Elasticsearch\Client;
  use App\Http\Requests;
  use App\Http\Controllers\Controller;
  
  use Illuminate\Http\Request;
  
  class AngularController extends Controller {
      public function selectRandom(Client $es, $numRows) {
          # ...search params here
          $results = $es-&gt;search($searchParams);
          return $results;
      }
  }
  </code></pre>
  
  <p>I need to call the method of the controller above from another controller, I do it like this:</p>
  
  <pre><code>class HomeCtrl extends Controller {
  
      public function index() {
  
          $featured = new AngularController();
  
          return $featured-&gt;selectRandom(12);
      }
  
  }
  </code></pre>
  
  <p>I get the following error</p>
  
  <blockquote>
    <p>Argument 1 passed to
    App\Http\Controllers\AngularController::selectRandom() must be an
    instance of Elasticsearch\Client, integer given</p>
  </blockquote>
  
  <p>I'm not well versed in OOP. Do I call it incorrectly? Because I though the method I call would take instance that is injected in controller, not from where I call it.</p>