📜  laravel db 查询日志字符串替换 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:01.351000             🧑  作者: Mango

代码示例1
DB::enableQueryLog();

# 
User::all();

$query = collect(DB::getQueryLog())->map(function($query){
  return str_replace_array('?', $query['bindings'], $query['query']);
})->join("\n");

dd($query); // Outputs: select * from `users`