I need to remove the pagination and leave everything on one page, but this way I'm doing it only generates BUG. I wonder why the snippet of the commented code doesn't work to remove the pagination.
if ($minParam || $maxParam) {
$products = Product::whereHas('sizes', function ($query) use ($minParam, $maxParam) {
if ($minParam && $maxParam) {
$query->whereBetween('max_capacity', [$minParam, $maxParam]);
} elseif ($minParam) {
$query->where('max_capacity', '>=', $minParam);
} else {
$query->where('max_capacity', '<=', $maxParam);
}
})
->whereHas('solutions', function ($query) use ($solution_id) {
$query->whereIn('solution_id', $solution_id);
})
->where('active', 1)
->orderBy('position', 'ASC')
->get();
//->paginate(16);
} else {
$products = Product::whereHas('solutions', function ($query) use ($solution_id) {
$query->whereIn('solution_id', $solution_id);
})
->where('active', 1)
->orderBy('position', 'ASC')
->get();
//->paginate(16);
}
return view('solutions.show')->with(compact('solutions', 'solution', 'products', 'ranges'));
} }
The bug after replacing with get ()
ErrorException (E_ERROR) Method Illuminate\Database\Eloquent\Collection::links does not exist. (View: /app/server/resources/views/solutions/show.blade.php) Previous exceptions Method Illuminate\Database\Eloquent\Collection::links does not exist.