• <small id='6Pbu7'></small><noframes id='6Pbu7'>

  • <tfoot id='6Pbu7'></tfoot>

  • <i id='6Pbu7'><tr id='6Pbu7'><dt id='6Pbu7'><q id='6Pbu7'><span id='6Pbu7'><b id='6Pbu7'><form id='6Pbu7'><ins id='6Pbu7'></ins><ul id='6Pbu7'></ul><sub id='6Pbu7'></sub></form><legend id='6Pbu7'></legend><bdo id='6Pbu7'><pre id='6Pbu7'><center id='6Pbu7'></center></pre></bdo></b><th id='6Pbu7'></th></span></q></dt></tr></i><div id='6Pbu7'><tfoot id='6Pbu7'></tfoot><dl id='6Pbu7'><fieldset id='6Pbu7'></fieldset></dl></div>
      • <bdo id='6Pbu7'></bdo><ul id='6Pbu7'></ul>
        <legend id='6Pbu7'><style id='6Pbu7'><dir id='6Pbu7'><q id='6Pbu7'></q></dir></style></legend>

        Laravel whereIn 或 whereIn

        时间:2023-10-31

        1. <tfoot id='BZMKC'></tfoot>

              <i id='BZMKC'><tr id='BZMKC'><dt id='BZMKC'><q id='BZMKC'><span id='BZMKC'><b id='BZMKC'><form id='BZMKC'><ins id='BZMKC'></ins><ul id='BZMKC'></ul><sub id='BZMKC'></sub></form><legend id='BZMKC'></legend><bdo id='BZMKC'><pre id='BZMKC'><center id='BZMKC'></center></pre></bdo></b><th id='BZMKC'></th></span></q></dt></tr></i><div id='BZMKC'><tfoot id='BZMKC'></tfoot><dl id='BZMKC'><fieldset id='BZMKC'></fieldset></dl></div>

              <small id='BZMKC'></small><noframes id='BZMKC'>

              <legend id='BZMKC'><style id='BZMKC'><dir id='BZMKC'><q id='BZMKC'></q></dir></style></legend>
                <bdo id='BZMKC'></bdo><ul id='BZMKC'></ul>
                  <tbody id='BZMKC'></tbody>

                  本文介绍了Laravel whereIn 或 whereIn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在按过滤器搜索产品:

                  I'm making a products search by filters:

                  我的代码:

                  ->where(function($query) use($filter)
                  {
                    if(!empty($filter)){
                      foreach ($filter as $key => $value) {           
                        $f = explode(",", $value);        
                        $query-> whereIn('products.value', $f);
                      }           
                    }
                  })
                  

                  查询:

                  and (products.value in (Bomann, PHILIPS) and products.value in (red,white)) 
                  

                  但我需要:

                  and (products.value in (Bomann, PHILIPS) OR products.value in (red,white)) 
                  

                  在 Laravel 中是否有类似的东西:

                  Is there something similar in Laravel:

                  orWhereIn
                  

                  推荐答案

                  您可以只在核心中搜索 whereIn 函数来查看.这个给你.这必须回答你所有的问题

                  You could have searched just for whereIn function in the core to see that. Here you are. This must answer all your questions

                  /**
                   * Add a "where in" clause to the query.
                   *
                   * @param  string  $column
                   * @param  mixed   $values
                   * @param  string  $boolean
                   * @param  bool    $not
                   * @return IlluminateDatabaseQueryBuilder|static
                   */
                  public function whereIn($column, $values, $boolean = 'and', $not = false)
                  {
                      $type = $not ? 'NotIn' : 'In';
                  
                      // If the value of the where in clause is actually a Closure, we will assume that
                      // the developer is using a full sub-select for this "in" statement, and will
                      // execute those Closures, then we can re-construct the entire sub-selects.
                      if ($values instanceof Closure)
                      {
                          return $this->whereInSub($column, $values, $boolean, $not);
                      }
                  
                      $this->wheres[] = compact('type', 'column', 'values', 'boolean');
                  
                      $this->bindings = array_merge($this->bindings, $values);
                  
                      return $this;
                  }
                  

                  看看它有第三个布尔参数.祝你好运.

                  Look that it has a third boolean param. Good luck.

                  这篇关于Laravel whereIn 或 whereIn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 Laravel 中编辑和保存自定义配置文件? 下一篇:Laravel 验证自定义消息

                  相关文章

                  <i id='J4mpo'><tr id='J4mpo'><dt id='J4mpo'><q id='J4mpo'><span id='J4mpo'><b id='J4mpo'><form id='J4mpo'><ins id='J4mpo'></ins><ul id='J4mpo'></ul><sub id='J4mpo'></sub></form><legend id='J4mpo'></legend><bdo id='J4mpo'><pre id='J4mpo'><center id='J4mpo'></center></pre></bdo></b><th id='J4mpo'></th></span></q></dt></tr></i><div id='J4mpo'><tfoot id='J4mpo'></tfoot><dl id='J4mpo'><fieldset id='J4mpo'></fieldset></dl></div>
                1. <tfoot id='J4mpo'></tfoot>
                      <bdo id='J4mpo'></bdo><ul id='J4mpo'></ul>

                    <small id='J4mpo'></small><noframes id='J4mpo'>

                    1. <legend id='J4mpo'><style id='J4mpo'><dir id='J4mpo'><q id='J4mpo'></q></dir></style></legend>