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