我用 :
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) { }
如何在Laravel 5中执行查询?
非常感谢你