Laravel whereIn OR whereIn

前端 未结 5 1597
盖世英雄少女心
盖世英雄少女心 2020-12-29 21:43

I\'m making a products search by filters:

My code:

->where(function($query) use($filter)
{
  if(!empty($filter)){
    foreach ($filter as $key =&g         


        
5条回答
  •  臣服心动
    2020-12-29 22:15

    You have a orWhereIn function in Laravel. It takes the same parameters as the whereIn function.

    It's not in the documentation but you can find it in the laravel API. http://laravel.com/api/4.1/

    That should give you this:

    $query-> orWhereIn('products.value', $f);
    

提交回复
热议问题