• <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

        Laravel whereIn OR whereIn(Laravel whereIn 或 whereIn)

        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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <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>
                              <tbody id='J4mpo'></tbody>