5
私が使用します。laravel 5の最後のクエリを表示する方法は?
DB::connection()->enableQueryLog();
var_dump(DB::getQueryLog());
しかし、それは働いていません。
私のサービスは、このようなものです:私はそれを実行すると、クエリが
を表示されません
public function dataCustomerList($param)
{
$status = $param['status_sort'];
$gender = $param['gender'];
$published = $param['published'];
if($published=='NO'){
$published_check = 'NO';
$published = 0;
}
else if($published=='YES'){
$published_check = 'YES';
$published = 1;
}
DB::connection()->enableQueryLog();
$customer = customer::paginate(10);
if(!empty($status)) {
// die($status);
$customer = customer::where('tb_customer.customer_status', '=', $status)->paginate(10);
}
if (!empty($gender)) {
$customer = customer::where('tb_customer.gender', '=', $gender)->paginate(10);
}
if (!empty($published_check)) {
$customer = customer::where('tb_customer.published', '=', $published)->paginate(10);
}
var_dump(DB::getQueryLog());
return $customer;
}
結果はこのようなものです:
array(0) {
}
クエリがで実行取得する方法ララベル5?
はあなたがquery events on DBに耳を傾けることができ、非常に
あなたはLaravel Debugbarを試みたことがありますか?リクエストで実行されたすべてのクエリを表示できます(時間と改善提案あり):https://github.com/barryvdh/laravel-debugbar –