<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] # 遠程關聯 國家 -> 用戶 -> 帖子 國家一對多用戶一對多帖子 countries 國家表 | 鍵名 | 類型 | | --- | --- | | id | PK | | uid | FK users's id | | name | varchar(200) | | users | 用戶表 | users 用戶表 | 鍵名 | 類型 | | --- | --- | | id | PK | | cid | FK countries's id | | username | varchar(200) | | posts | 發帖表 | posts 發帖表 | 鍵名 | 類型 | | --- | --- | | id | PK | | uid | FK users's id | | title | varchar(200) | | content | text | | created_at | timestamp | | updated_at | timestamp | # 實現 Country.php ~~~ function posts() { //參數順序為 model through_model first_key second_key local_key return $this->hasManyThrough(Post::class,User::class, 'cid', 'uid', 'id'); } ~~~ ID 參數的順序: > first_key 為CLASS的 id 的外鍵 對應 countries' id > second_key 為中間表的 id 的外鍵 對應 users' id > other_key 為CLASS的 id # 操作 ## 查 ~~~ $county = County::find(2); $county->posts(); ~~~ ## 新增/修改/刪除 對于這種復雜的場景,發帖,應該是 「用戶 - 發帖」這樣一對多關系,「發帖」 與「國家」并無直接無關,所以需要分解場景。 此三級關系一般只用于查找。 associate()不適用用于morphTo();所以只能單向的用save()綁定了; 關于解綁,dissociate()也不適用用于morphTo();所以,只能把實例刪除!!刪除了就沒任何關系了(因為沒有中間表)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看