haizone
124
1
Laravel

how to use filter after paginate

Posted 9 months ago by haizone

hi

i have a list of products that i show with paginate(20)

its in cache

now i make a filter and i do that like this:

    if ($request->subject) {

    $products = $products->filter(function ($product) {
      return $product->specValues->whereIn('value',['Samsung'])->contains('field_id','1');
    })->count();

    }

now the filter work only on the first page and show me from the 20 products the products with that values

how i make that to show me from all the pages witour to call all the products again?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.