title: Laravel 5.4 - Paginate from array collection products
body: <p>i'm trying to paginate a collection's products, like this: </p>
  
  <pre><code>$products_array = array();
  
          for ($i=0; $i &lt; count($t); $i++) { 
  
              $p = Product::where('category_id',$t[$i]-&gt;category_default)-&gt;where('project_id',$t[$i]-&gt;id)-&gt;first();
              array_push($products_array, $p);
          }
  
          $paginate = new Illuminate\Pagination\LengthAwarePaginator($products_array, count($products_array), 10, 1, ['path'=&gt;url('api/products')]);
  
          dd($paginate);
  </code></pre>
  
  <p>But i get this error: </p>
  
  <blockquote>
    <p>FatalThrowableError in HomeController.php line 75: Class
    'Shop\Http\Controllers\Illuminate\Pagination\LengthAwarePaginator' not
    found</p>
  </blockquote>
  
  <p>i don't know if this is the best way to do this, I would appreciate your help. </p>