title: Laravel Type error: Too few arguments to function
body: <p>I created a controller with an index controller : </p>
  
  <pre><code>public function index(EntityRepository $vcs, EntityRepository $vcskns)
  {
      $entitiesLists = $vcs-&gt;getEntities();
      $entitiesWithKnLists = $vcskns-&gt;getEntitiesWithKeyneeds();
  
      return view('admin.home', compact('entitiesLists', 'entitiesWithKnLists'));
  }
  </code></pre>
  
  <p>In EntityRepository I created getEntitiesWithKeyneeds : </p>
  
  <pre><code>public function getEntitiesWithKeyneeds()
  {
      $valuechains = Valuechain::orderBy('valuechains.id')
          -&gt;join('lang_valuechain', 'valuechains.id', '=', 'lang_valuechain.valuechain_id')
          -&gt;join('langs', 'lang_valuechain.lang_id', '=', 'langs.id')
          -&gt;where('langs.isMainlanguage', '=', '1')
          -&gt;with('segments')
          -&gt;with('keyneeds')
          -&gt;withCount('segments')
          -&gt;withCount('keyneeds')
          -&gt;get();
  
  
      foreach ($valuechains as $valuechain) {
          $ids[] = $valuechain-&gt;id;
      }
  
      foreach ($ids as $id) {
          $vcskns[] = Segment::select(
              'lang_valuechain.vcname', 'lang_valuechain.vcshortname',
              'lang_segment.segname', 'lang_segment.segshortname', 'segments.id',
              'lang_segment.created_at', 'lang_segment.updated_at', 'lang_segment.deleted_at'
          )
              -&gt;distinct()
              -&gt;withCount('keyneeds')
              -&gt;join('lang_segment', 'segments.id', '=', 'lang_segment.segment_id')
              -&gt;join('valuechains', 'segments.valuechain_id', '=', 'valuechains.id')
              -&gt;join('lang_valuechain', 'valuechains.id', '=', 'lang_valuechain.valuechain_id')
              -&gt;join('sectors', 'valuechains.sector_id', '=', 'sectors.id')
              -&gt;join('lang_sector', 'sectors.id', '=', 'lang_sector.sector_id')
              -&gt;join('langs', 'lang_valuechain.lang_id', '=', 'langs.id')
              -&gt;where([
                  ['langs.isMainlanguage', '=', '1'],
                  ['valuechains.id', '=', $id]
              ])
              -&gt;whereNull('valuechains.deleted_at')
              -&gt;whereNull('sectors.deleted_at')
              -&gt;whereNull('segments.deleted_at')
              -&gt;get();
  
      }
      return $vcskns;
  }
  </code></pre>
  
  <p>I receive an error message : </p>
  
  <p>Type error: Too few arguments to function App\Http\Controllers\BackOffice\StatsController::index(), 1 passed and exactly 2 expected</p>
  
  <p>I wish i could solve this issue.</p>
  
  <p>Another issue would be to know how i could force every views of my backend to have the returns of my EntityRepository. theorirically i have to declare my variables in all my methods ... </p>