vendredi 23 octobre 2020

How to remove paginate in Laravel?

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'));
    
    }


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3mibXjk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire