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

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

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

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

      在 Laravel Eloquent 中檢索所有 morphedByMany 關系

      Retrieving all morphedByMany relations in Laravel Eloquent(在 Laravel Eloquent 中檢索所有 morphedByMany 關系)
      <i id='LfYaq'><tr id='LfYaq'><dt id='LfYaq'><q id='LfYaq'><span id='LfYaq'><b id='LfYaq'><form id='LfYaq'><ins id='LfYaq'></ins><ul id='LfYaq'></ul><sub id='LfYaq'></sub></form><legend id='LfYaq'></legend><bdo id='LfYaq'><pre id='LfYaq'><center id='LfYaq'></center></pre></bdo></b><th id='LfYaq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='LfYaq'><tfoot id='LfYaq'></tfoot><dl id='LfYaq'><fieldset id='LfYaq'></fieldset></dl></div>
        • <tfoot id='LfYaq'></tfoot>
          <legend id='LfYaq'><style id='LfYaq'><dir id='LfYaq'><q id='LfYaq'></q></dir></style></legend>
            <tbody id='LfYaq'></tbody>

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

            • <bdo id='LfYaq'></bdo><ul id='LfYaq'></ul>
                本文介紹了在 Laravel Eloquent 中檢索所有 morphedByMany 關系的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                在 Laravel 文檔中,有以下示例用于檢索 morphedByMany 關系,這是多對多的多態關系.

                In the Laravel documentation, there is the following example for retrieving morphedByMany relations, which are many-to-many polymorphic relations.

                Laravel 多對多多態關系文檔

                namespace App;
                
                use IlluminateDatabaseEloquentModel;
                
                class Tag extends Model
                {
                    /**
                     * Get all of the posts that are assigned this tag.
                    */
                    public function posts()
                    {
                        return $this->morphedByMany('AppPost', 'taggable');
                    }
                
                    /**
                     * Get all of the videos that are assigned this tag.
                     */
                    public function videos()
                    {
                        return $this->morphedByMany('AppVideo', 'taggable');
                    }
                }
                

                我如何獲得一個查詢/集合中所有 morphed 關系的列表,例如 postsvideos,然后如果我后來添加了照片(或任何東西),那也是?

                How would I get a list of all morphed relations in one query / collection, for instance, posts and videos, and then if I later added photos (or anything), that too?

                推薦答案

                我在這里使用一個技巧:

                I use a trick here:

                為您的連接表 taggable 創建一個模型 Taggable 并添加一個 hasMany 關系到 Tag 模型.

                Create a Model Taggable for your connection table taggable and add a hasMany relation to the Tag model.

                public function related()
                {
                    return $this->hasMany(Taggable::class);
                }
                

                在你的 Taggable 模型中創建一個 morphedTo 關系.

                Within your Taggable model create a morphedTo relation.

                public function taggables()
                {
                    return $this->morphTo();
                }
                

                現在您可以通過調用獲取所有使用該標簽的模型:

                Now you can get all models which are using the tag by calling:

                $tagged = Tag::with('related.taggables');
                

                這篇關于在 Laravel Eloquent 中檢索所有 morphedByMany 關系的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 找不到驅動程序)
                <legend id='CkMsA'><style id='CkMsA'><dir id='CkMsA'><q id='CkMsA'></q></dir></style></legend>
                  <tbody id='CkMsA'></tbody>

                  <tfoot id='CkMsA'></tfoot>

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

                          <bdo id='CkMsA'></bdo><ul id='CkMsA'></ul>
                        • <i id='CkMsA'><tr id='CkMsA'><dt id='CkMsA'><q id='CkMsA'><span id='CkMsA'><b id='CkMsA'><form id='CkMsA'><ins id='CkMsA'></ins><ul id='CkMsA'></ul><sub id='CkMsA'></sub></form><legend id='CkMsA'></legend><bdo id='CkMsA'><pre id='CkMsA'><center id='CkMsA'></center></pre></bdo></b><th id='CkMsA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CkMsA'><tfoot id='CkMsA'></tfoot><dl id='CkMsA'><fieldset id='CkMsA'></fieldset></dl></div>
                          主站蜘蛛池模板: 欧美精品在线播放 | 天天干狠狠操 | 米奇7777狠狠狠狠视频 | 中文字幕免费在线 | 国产精品久久久久久婷婷天堂 | 久久精品97| 日韩精品久久 | 97精品超碰一区二区三区 | 视频在线一区 | 久久久成人精品 | 欧美一级片在线看 | 午夜精品一区 | 91啪影院 | 亚洲精品视频一区二区三区 | 日韩伦理电影免费在线观看 | 久久av一区二区 | 欧美v在线观看 | 日本一区二区三区四区 | 91超碰在线观看 | 人干人人 | 视频二区在线观看 | 国产99久久精品一区二区永久免费 | 亚洲人成人一区二区在线观看 | 亚州激情 | 国产97在线看 | 黄片毛片 | 久久国产亚洲 | 中文一区 | 97精品国产97久久久久久免费 | 蜜桃在线视频 | 久久国产成人 | 91久久电影 | 国产一区在线免费 | 羞羞的视频在线观看 | 一区二区三区在线播放 | 黄色免费在线网址 | 国产日韩欧美 | 国产一区二区三区久久 | 国产麻豆一区二区三区 | 成人精品国产一区二区4080 | 日韩免费视频一区二区 |