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

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

    1. <tfoot id='Ad4Th'></tfoot>
    2. <small id='Ad4Th'></small><noframes id='Ad4Th'>

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

        Laravel Eloquent 關(guān)于關(guān)系的分頁(yè)

        Laravel Eloquent pagination on relationships(Laravel Eloquent 關(guān)于關(guān)系的分頁(yè))

            <tbody id='2JmtB'></tbody>

            1. <tfoot id='2JmtB'></tfoot>
            2. <small id='2JmtB'></small><noframes id='2JmtB'>

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

                • <bdo id='2JmtB'></bdo><ul id='2JmtB'></ul>
                  本文介紹了Laravel Eloquent 關(guān)于關(guān)系的分頁(yè)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我正在嘗試為這樣的 Eloquent 關(guān)系分頁(yè):

                  I am trying to paginate a Eloquent relationship like this:

                   $query = Product::find(1)->options()->paginate();
                  

                  但我收到以下錯(cuò)誤:

                  Fatal error: Call to a member function getCurrentPage() on a non-object
                  

                  我已經(jīng)確認(rèn)代碼 $query = Product::find(1)->options() 返回一個(gè)選項(xiàng)集合.$query 對(duì)象似乎是 hasMany 類(lèi)型.以下是我正在使用的模型類(lèi).

                  I have confirmed that the code $query = Product::find(1)->options() returns a collection of options. The $query object seems to be of type hasMany. Below are the model classes I am using.

                  class Product extends Eloquent
                  {
                  
                      protected $table = 'products';
                  
                      public function options ()
                      {
                          return $this->hasMany('ProductOption', 'product_id');
                      }
                  }
                  
                  class ProductOption extends Eloquent
                  {
                      protected $table = 'product_options';
                  
                      public function product()
                      {
                          return $this->belongsTo('Product', 'product_id');
                      }
                  }
                  

                  eloquent 不返回關(guān)系的分頁(yè)結(jié)果嗎?

                  Does eloquent not return paginated results for relationships?

                  推薦答案

                  你不能像這樣延遲加載關(guān)系分頁(yè),而是在你的產(chǎn)品模型中把以下函數(shù)放在你的選項(xiàng)下面有很多關(guān)系

                  You can not lazy load relational pagination like that, instead in your Product Model put the following function below your options has many relationship

                  public function getOptionsPaginatedAttribute()
                  {
                      return $this->options()->paginate(10);
                  }
                  

                  這將允許您通過(guò)

                  $product->options_paginated
                  

                  這篇關(guān)于Laravel Eloquent 關(guān)于關(guān)系的分頁(yè)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

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

                        <bdo id='j8Aj1'></bdo><ul id='j8Aj1'></ul>
                            <tbody id='j8Aj1'></tbody>

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

                            <tfoot id='j8Aj1'></tfoot>
                          2. <small id='j8Aj1'></small><noframes id='j8Aj1'>

                          3. <i id='j8Aj1'><tr id='j8Aj1'><dt id='j8Aj1'><q id='j8Aj1'><span id='j8Aj1'><b id='j8Aj1'><form id='j8Aj1'><ins id='j8Aj1'></ins><ul id='j8Aj1'></ul><sub id='j8Aj1'></sub></form><legend id='j8Aj1'></legend><bdo id='j8Aj1'><pre id='j8Aj1'><center id='j8Aj1'></center></pre></bdo></b><th id='j8Aj1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='j8Aj1'><tfoot id='j8Aj1'></tfoot><dl id='j8Aj1'><fieldset id='j8Aj1'></fieldset></dl></div>
                            主站蜘蛛池模板: 国产精品欧美一区二区三区不卡 | 久久精品一区 | 99精品欧美一区二区三区综合在线 | 欧美888 | 国产又爽又黄的视频 | 亚洲视屏 | 日本电影免费完整观看 | www.午夜| 一区二区三区小视频 | 国产精品久久久久久久久久免费 | 精品中文字幕在线观看 | 国产视频第一页 | 成人免费一级视频 | 黄片毛片免费看 | 黄色网毛片| 成人亚洲 | 亚洲一区二区三区桃乃木香奈 | 亚洲一区二区三区四区五区中文 | 91久久国产综合久久91精品网站 | 欧美a∨ | 色婷婷激情 | 中文字幕精品一区二区三区精品 | 国产精品成人一区二区 | 国产精品爱久久久久久久 | 日韩精品一区二区三区中文在线 | 97国产精品 | 国产视频1区 | 中文字幕国产 | 国产情侣在线看 | 午夜影院在线免费观看视频 | 在线观看日韩精品视频 | 中文字幕一区二区三区四区五区 | 国产一区久久久 | 精品欧美一区二区在线观看 | 日本特黄a级高清免费大片 国产精品久久性 | 亚洲一区在线日韩在线深爱 | 日韩免费网 | 国产一区二区三区视频免费观看 | 国产精品久久久久免费 | 亚洲精品国产偷自在线观看 | 久久精品国产亚洲 |