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

    <legend id='FKsOU'><style id='FKsOU'><dir id='FKsOU'><q id='FKsOU'></q></dir></style></legend>

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

    1. <small id='FKsOU'></small><noframes id='FKsOU'>

      Laravel 合并關系

      Laravel merge relationships(Laravel 合并關系)

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

            <legend id='LVk1A'><style id='LVk1A'><dir id='LVk1A'><q id='LVk1A'></q></dir></style></legend>
            • <bdo id='LVk1A'></bdo><ul id='LVk1A'></ul>
                <tbody id='LVk1A'></tbody>
              <tfoot id='LVk1A'></tfoot>

                本文介紹了Laravel 合并關系的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                有沒有辦法在 Laravel 中合并 2 個關系?

                Is there a way to merge 2 relationships in laravel?

                這是它現在的設置方式,但是有沒有辦法可以將兩者合并?

                this is the way it's setup now, but Is there a way I could return both merged?

                  public function CompetitionsHome() {
                    return $this->HasMany( 'Competition', 'home_team_id' );
                  }
                  public function CompetitionsGuest() {
                    return $this->HasMany( 'Competition', 'guest_team_id' );
                  }
                  public function Competitions() {
                    // return both CompetitionsHome & CompetitionsGuest
                  }
                

                推薦答案

                嘗試返回從關系返回的合并集合的屬性的 getter 方法.

                Try out getter method for property which returns merged collections returned from relations.

                public function getCompetitionsAttribute($value)
                {
                    // There two calls return collections
                    // as defined in relations.
                    $competitionsHome = $this->competitionsHome;
                    $competitionsGuest = $this->competitionsGuest;
                
                    // Merge collections and return single collection.
                    return $competitionsHome->merge($competitionsGuest);
                }
                

                或者您可以在返回集合之前調用其他方法以獲得不同的結果集.

                Or you can call additional methods before collection is returned to get different result sets.

                public function getCompetitionsAttribute($value)
                {
                    // There two calls return collections
                    // as defined in relations.
                    // `latest()` method is shorthand for `orderBy('created_at', 'desc')`
                    // method call.
                    $competitionsHome = $this->competitionsHome()->latest()->get();
                    $competitionsGuest = $this->competitionsGuest()->latest()->get();
                
                    // Merge collections and return single collection.
                    return $competitionsHome->merge($competitionsGuest);
                }
                

                這篇關于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 找不到驅動程序)
              1. <tfoot id='2ABMU'></tfoot>
              2. <legend id='2ABMU'><style id='2ABMU'><dir id='2ABMU'><q id='2ABMU'></q></dir></style></legend>
                1. <small id='2ABMU'></small><noframes id='2ABMU'>

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

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

                        <bdo id='2ABMU'></bdo><ul id='2ABMU'></ul>
                          主站蜘蛛池模板: 麻豆毛片 | 夜夜夜操 | 一区二区三区四区不卡视频 | 亚洲免费高清 | 久久久不卡网国产精品一区 | 久久久国产精品 | 日韩一区二区三区视频在线播放 | 久久国产精品免费视频 | 网站国产 | 成人免费xxxxx在线视频 | 欧美aⅴ | 亚洲瑟瑟| 一级大片 | 国产激情自拍视频 | 情侣酒店偷拍一区二区在线播放 | 亚洲视频 欧美视频 | 日韩视频一区二区 | 欧美日韩免费在线 | 久久精品av | 精品国产色 | 免费骚视频 | 午夜视频免费 | 日本电影免费完整观看 | 欧美久久久久久 | 在线观看av网站永久 | 韩国电影久久 | 亚洲欧美日韩精品久久亚洲区 | 亚洲精品久久久久久久久久久久久 | 欧美激情欧美激情在线五月 | 国产成人99久久亚洲综合精品 | 国产在线精品区 | 99re视频这里只有精品 | 亚洲午夜网 | 国产丝袜一区二区三区免费视频 | 国产成人精品综合 | 久草精品视频 | 日韩欧美中文字幕在线观看 | 国产精品久久 | 天天综合网天天综合色 | 免费黄网站在线观看 | 免费在线播放黄色 |