我在我的web.php
這條路線:顯示在laravel雄辯執行的所有SQL 5.4
Route::get('task' , function(){
return App\Carsoul::all();
});
這個代碼回報:
[{"id":12,"image":"1502286679.jpg"},{"id":14,"image":"1502287112.jpg"}]
我想顯示的查詢返回上面的結果,所以我加Route
之前此代碼:
希望返回,如:SELECT* FROM 'carsouls' ...
但返回相同的結果:
[{"id":12,"image":"1502286679.jpg"},{"id":14,"image":"1502287112.jpg"}]
什麼是錯?
您應該查看https://laravel.com/docs/5.0/database#query-logging。它適用於版本5.0,雖然有點過時,但除非他們刪除它,否則它仍然適用於您。或從5.4文檔:https://laravel.com/docs/5.4/database#listening-for-query-events –