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.
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);
}
})->
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')
->paginate(16);
} else {
$products = Product::whereHas('solutions', function ($query) use ($solution_id) {
$query->whereIn('solution_id', $solution_id);
})
->where('active', 1)
->orderBy('position', 'ASC')
->paginate(16);
/*$products = Product::whereHas('solutions', function ($query) use ($solution_id) {
$query->whereIn('solution_id', $solution_id);
})
->where('active', 1)
->orderBy('position', 'ASC');*/
return view('solutions.show')->with(compact('solutions', 'solution', 'products', 'ranges'));
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire