\DB::connection()->enableQueryLog();
// 查詢數據庫信息...
$data = Subject::where('subject_id', 1)->first();
$queries = \DB::getQueryLog();
dd($queries);
Response
array:1 [
0 => array:3 [
"query" => "select * from `subjects` where `subject_id` = ? limit 1"
"bindings" => array:1 [
0 => 1
]
"time" => 3.78
]
]