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

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

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

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

      1. <tfoot id='shbnG'></tfoot>

          <bdo id='shbnG'></bdo><ul id='shbnG'></ul>
      2. 如何從連接表中選擇列:laravel eloquent

        How to select columns from joined tables: laravel eloquent(如何從連接表中選擇列:laravel eloquent)

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

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

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

                  <tbody id='waz8T'></tbody>

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

                  本文介紹了如何從連接表中選擇列:laravel eloquent的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有一個(gè)與 這個(gè)不同的問題.場景相同,但我需要對結(jié)果進(jìn)行更多過濾.

                  I have a different problem from this. The scenario is same but I am in need of more filtration of the results.

                  讓我解釋一下.

                  考慮我有 2 張桌子

                  車輛

                   id
                   name
                   staff_id
                   distance
                   mileage
                  

                  員工

                   id
                   name
                   designation
                  

                  我只想從兩個(gè)表(模型)中選擇 idname.Vehicle Model 包含與 Staff 模型的 belongsTo 關(guān)系.

                  I want to select only id and name from both tables(Models). The Vehicle Model contain a belongsTo relation to Staff model.

                  class Vehicle extends Model
                  {
                      public function staff()
                      {
                        return $this->belongsTo('AppStaff','staff_id');
                      }
                  }
                  

                  我加入使用這個(gè)

                  Vehicle::where('id',1)
                              ->with(['staff'=> function($query){
                                              // selecting fields from staff table
                                              $query->select(['staff.id','staff.name']);
                                            }])
                              ->get();
                  

                  當(dāng)我像這樣將字段放在 ->get() 中時(shí)

                  When I put fields in ->get() like this

                  ->get(['id','name'])
                  

                  它過濾了vehicle表,但沒有產(chǎn)生Staff表的結(jié)果.

                  it filters the vehicle table but produce no result of Staff table.

                  有什么想法嗎?

                  推薦答案

                  終于找到了..在 ->get() 中,你必須像這樣輸入 'staff_id'

                  Finally found it.. In the ->get() you have to put the 'staff_id' like this

                  Vehicle::where('id',1)
                              ->with(['staff'=> function($query){
                                              // selecting fields from staff table
                                              $query->select(['staff.id','staff.name']);
                                            }])
                              ->get(['id','name','staff_id']);
                  

                  由于我沒有使用 staff_id,它無法執(zhí)行連接,因此沒有顯示人員表字段.

                  Since I didn't take the staff_id, it couldn't perform the join and hence staff table fields were not shown.

                  這篇關(guān)于如何從連接表中選擇列:laravel eloquent的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(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)程序)

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

                      • <bdo id='Rskqk'></bdo><ul id='Rskqk'></ul>

                            <tbody id='Rskqk'></tbody>
                          <tfoot id='Rskqk'></tfoot>
                          <i id='Rskqk'><tr id='Rskqk'><dt id='Rskqk'><q id='Rskqk'><span id='Rskqk'><b id='Rskqk'><form id='Rskqk'><ins id='Rskqk'></ins><ul id='Rskqk'></ul><sub id='Rskqk'></sub></form><legend id='Rskqk'></legend><bdo id='Rskqk'><pre id='Rskqk'><center id='Rskqk'></center></pre></bdo></b><th id='Rskqk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Rskqk'><tfoot id='Rskqk'></tfoot><dl id='Rskqk'><fieldset id='Rskqk'></fieldset></dl></div>
                        1. <legend id='Rskqk'><style id='Rskqk'><dir id='Rskqk'><q id='Rskqk'></q></dir></style></legend>
                            主站蜘蛛池模板: 亚洲人成人网 | 国内自拍偷拍视频 | 手机看黄av免费网址 | 97色在线观看免费视频 | 国内自拍偷拍视频 | 成人a视频片观看免费 | 久久国产一区二区三区 | 日韩成人| 日韩有码一区 | 日韩黄色小视频 | www.亚洲 | 少妇av片| 98成人网| 综合国产 | 日韩中文字幕一区 | 国产女人与拘做受免费视频 | 亚洲美女在线一区 | 成人免费观看视频 | 国产一二三区精品视频 | www日本高清 | 在线一区视频 | 综合色播 | 免费黄色片在线观看 | 日本二区在线观看 | 久久久久久成人 | 国产一区 | 人人爽人人爽人人片av | 国产精品毛片 | 99视频入口 | 午夜影院 | 最新免费视频 | 精品少妇一区二区三区在线播放 | 国产麻豆乱码精品一区二区三区 | 久久精品国产久精国产 | 91视频一区二区三区 | 国产日韩欧美中文字幕 | 午夜私人影院在线观看 | 欧美日韩成人在线观看 | 精品欧美一区二区三区久久久 | 激情毛片 | 精品国产欧美一区二区三区成人 |