2014-11-03 88 views
2

我有一個「客戶」表,我試圖讓使用客戶的ID使用Laravel洋洋灑灑記錄:當這個我檢查了MySQL被執行雄辯準備查詢,但不執行

Customer::where('customer_id', '=', $customer_id)->get(); 

然而,日誌和我得到:

Prepare select `kanji_name` from `customer` where `customer_id` = ? 
Close stmt 
Quit 

正如你所看到的,有沒有「執行......」登錄這應該是目前查詢的準備之後被處死。

我也試過:

Customer::find($customer_id); 

具有相同的結果。

有沒有人知道原因?

+0

你有沒有想過這個?我有完全相同的問題。 – Anthony 2016-03-08 18:11:46

+0

是的,我做到了。看到我的答案。 在我的開發環境中,我禁用了MySQL緩存,因此我總是得到執行日誌。這使我更容易檢查實際發送給MySQL的參數。 – gmarintes 2016-03-08 20:49:03

回答

0

似乎在Eloquent方或MySQL方面(可能在MySQL方面)發生某種形式的緩存。

我重新啓動我的MySQL服務器和發現,我的第一次嘗試,我得到

Prepare select * from `customer` where `customer_id` = ? 
Execute select * from `customer` where `customer_id` = '4058' 
Close stmt 
Quit 

雖然在隨後的嘗試,我得到:

Prepare select * from `customer` where `customer_id` = ? 
Close stmt 
Quit 

0

你可以做到這一點

$cust = Customer::where('customer_id', '=', $customer_id)->get(); 
dd($cust); 

對不起,不enugh代表發表評論。什麼是DD輸出?

+0

它打印Eloquent對象。但是,那不是我正在尋找的。我正在尋找缺少執行登錄我的MySQL日誌。 – gmarintes 2014-11-03 18:04:53