久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='ER1QZ'></small><noframes id='ER1QZ'>

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

          <bdo id='ER1QZ'></bdo><ul id='ER1QZ'></ul>

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

        什么是 WhereHas Laravel 中的關系計數條件

        What is relationship count condition in WhereHas Laravel(什么是 WhereHas Laravel 中的關系計數條件)
        1. <small id='HEyqK'></small><noframes id='HEyqK'>

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

                <bdo id='HEyqK'></bdo><ul id='HEyqK'></ul>

                    <tbody id='HEyqK'></tbody>
                1. 本文介紹了什么是 WhereHas Laravel 中的關系計數條件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我很難理解 WhereHas 中的關系計數條件.文檔頁面沒有關于它的討論,但 API 頁面討論了它.來自 API 的報價.

                  I am having a difficulty understanding the relationship count condition in WhereHas. The docs page does not have discussion about it but API page talks about it. Quote from API.

                  Builder|Builder whereHas(string $relation, Closure $callback, string$operator = '>=', int $count = 1)

                  Builder|Builder whereHas(string $relation, Closure $callback, string $operator = '>=', int $count = 1)

                  使用 where 子句向查詢添加關系計數條件.

                  Add a relationship count condition to the query with where clauses.

                  示例

                  Resource 模型與 ResourceCategory

                  public function categories()
                  {
                      return $this->belongsToMany('ResourceCategory', 'resource_category_mapping');
                  }
                  

                  Has 中的關系條件

                  Has 中的關系條件按預期工作.

                  The relationship condition in Has is working as expected.

                  Resource::has('categories', '>', 1)->get()
                  //this return all resources which have more than one catgories
                  

                  WhereHas 中的關系條件

                  WhereHas 中的關系條件未按預期工作.我確定我誤解了它.

                  The relationship condition in WhereHas is not working as expected. I am sure I have misunderstood it.

                  Resource::whereHas('categories', function ( $query){
                              $query->whereIn('resource_category_id', [1, 2, 4]);
                          }, '>', 1)->get()
                  

                  上面的代碼應該返回類別屬于 [1, 2, 4] 之一的資源,并且該資源有多個類別.但事實并非如此.

                  The above code should return resources which whose categories belong to either of [1, 2, 4] and the resource has more than one categories. But it is not.

                  問題

                  請解釋WhereHas中的關系條件,可能提供一個例子會很有幫助.

                  Kindly explain the relationship condition in WhereHas, may be providing an example would be much helpful.

                  推薦答案

                  通常,whereHas() 檢查您的模型是否具有至少一個相關模型.您可以將 $count 設置為更高的值,以將計數增加到 N 并僅獲取至少具有 N 個相關模型的模型.

                  Normally, whereHas() checks if your model has at least one related model. You can set $count to some higher value to increase the count to Nand fetch only the models that have at least N related models.

                  在你的情況下,打電話

                  Resource::has('categories', '>', 2)->get();
                  

                  將僅返回具有至少 2 個 相關類別的資源.

                  will return only those Resources that have at least 2 related categories.

                  這篇關于什么是 WhereHas Laravel 中的關系計數條件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                  <small id='6vlp5'></small><noframes id='6vlp5'>

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

                            主站蜘蛛池模板: 日一日操一操 | 日韩综合在线视频 | 久久精品国产免费 | 人人做人人澡人人爽欧美 | 亚洲精品视频免费观看 | 国产欧美日韩在线播放 | 国产精品久久久久久久久久久久久久 | 99re热精品视频国产免费 | 91精品国产一区二区三区 | 日韩一区二区在线播放 | 在线观看中文字幕 | 综合国产 | 国产一区二区精品在线观看 | 99re热精品视频 | 中文字幕高清 | 亚洲精品二区 | 午夜天堂精品久久久久 | 在线观看中文字幕一区二区 | 密色视频| 中文字幕视频在线观看 | 91精品国产91久久久久久密臀 | 亚洲情侣视频 | 中文字幕国产精品视频 | 亚洲天堂999| 免费在线成人 | 狠狠躁18三区二区一区 | 91精品国产一区 | 奇米超碰在线 | 国产精品不卡 | 日韩精品在线看 | 国产在线播 | www..com18午夜观看 | 成人自拍视频网站 | 国产操操操 | 国产欧美视频一区 | 亚av在线| 成人av一区二区三区 | 国产精品一区在线 | 成人福利电影 | 黄色毛片免费看 | 国产视频中文字幕 |