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

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

  • <small id='h367l'></small><noframes id='h367l'>

  • <legend id='h367l'><style id='h367l'><dir id='h367l'><q id='h367l'></q></dir></style></legend>

      1. Laravel Eloquent LEFT JOIN WHERE NULL

        Laravel Eloquent LEFT JOIN WHERE NULL(Laravel Eloquent LEFT JOIN WHERE NULL)

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

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

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

              <tfoot id='RdVTp'></tfoot>
                • 本文介紹了Laravel Eloquent LEFT JOIN WHERE NULL的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試使用 Eloquent 在數據庫種子期間執行以下查詢:

                  I'm trying to use Eloquent to perform the following query during a database seed:

                  SELECT
                      *
                  FROM
                      customers
                  LEFT JOIN
                      orders
                      ON customers.id = orders.customer_id
                  WHERE
                      orders.customer_id IS NULL
                  

                  這是我在 Eloquent 中的實現:

                  And here is my implementation in Eloquent:

                  $c = Customer::leftJoin('orders', function($join) {
                        $join->on('customers.id', '=', 'orders.customer_id');
                      })
                      ->whereNull('orders.customer_id')
                      ->first();
                  

                  第一個查詢總是返回完整的結果,而 Eloquent 的等效項總是返回空元素,除了 customersemailphone 字段> 桌子.我無法解釋這一點,因為 CustomersOrders 模型都是工匠生成的骨架.

                  Whereas the first query always returns full results, the Eloquent equivalent always returns empty elements for everything but the email and phone fields of the customers table. I'm at a loss to explain this since the Customers and Orders models are both artisan generated skeletons.

                  例如:

                  class Customer extends Eloquent {
                  
                      // Add your validation rules here
                      public static $rules = [
                          // 'title' => 'required'
                      ];
                  
                      // Don't forget to fill this array
                      protected $fillable = [];
                  
                  }
                  

                  這是當我 dd() 對種子(最初由 Faker 生成)第一個 Eloquent 查詢時輸出的數組:

                  Here is the array that is output when I dd() the first Eloquent query on a seed (generated originally by Faker):

                  protected $original =>
                    array(25) {
                      'id' =>
                      NULL
                      'first_name' =>
                      NULL
                      'last_name' =>
                      NULL
                      'email' =>
                      string(24) "luther.braun@example.org"
                      'phone' =>
                      string(17) "642.150.9176x5684"
                      'address1' =>
                      NULL
                      'address2' =>
                      NULL
                      'city' =>
                      NULL
                      'state' =>
                      NULL
                      'county' =>
                      NULL
                      'district' =>
                      NULL
                      'postal_code' =>
                      NULL
                      'country' =>
                      NULL
                      'notes' =>
                      NULL
                      'created_at' =>
                      NULL
                      'updated_at' =>
                      NULL
                      'customer_id' =>
                      NULL
                      'total' =>
                      NULL
                  }
                  

                  推薦答案

                  這可以通過指定特定表中所需的特定列名來解決,如下所示:

                  This can be resolved by specifying the specific column names desired from the specific table like so:

                  $c = Customer::leftJoin('orders', function($join) {
                        $join->on('customers.id', '=', 'orders.customer_id');
                      })
                      ->whereNull('orders.customer_id')
                      ->first([
                          'customers.id',
                          'customers.first_name',
                          'customers.last_name',
                          'customers.email',
                          'customers.phone',
                          'customers.address1',
                          'customers.address2',
                          'customers.city',
                          'customers.state',
                          'customers.county',
                          'customers.district',
                          'customers.postal_code',
                          'customers.country'
                      ]);
                  

                  這篇關于Laravel Eloquent LEFT JOIN WHERE NULL的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 找不到驅動程序)
                    <bdo id='eqhJn'></bdo><ul id='eqhJn'></ul>
                      <tbody id='eqhJn'></tbody>

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

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

                            主站蜘蛛池模板: 亚洲欧美综合网 | 亚洲视频二区 | 日本午夜视频 | 久久精品国产免费 | 农村妇女毛片精品久久久 | 91麻豆产精品久久久久久夏晴子 | 免费xxxx大片国产在线 | 精品国产视频 | 久久精品免费观看 | 中文字幕亚洲一区二区三区 | 亚洲精品一二三区 | 中文字幕精品一区久久久久 | 亚洲一区二区三区在线视频 | 亚洲一二三区在线观看 | 精品1区2区3区4区 | 精品国产欧美一区二区 | 亚洲一区二区三区在线视频 | 91久久久久久 | 精品国产一区二区在线 | 亚洲一区在线观看视频 | 天天看天天操 | 国产激情福利 | 亚洲天堂一区二区 | 国产一区二区三区免费 | 亚洲精品黄色 | 亚洲国产精品成人综合久久久 | 九色视频网 | 99精品视频一区二区三区 | 91在线视频一区 | 中文在线www | 中文在线一区二区 | 成人在线 | 看片网站在线 | 日韩一区二区免费视频 | 尤物在线精品视频 | 久久99精品久久久 | 午夜精品久久久久久久星辰影院 | 午夜av影院 | 国产午夜精品一区二区三区四区 | 国产在线视频一区二区董小宛性色 | 日韩国产高清在线观看 |