在 Illuminate\Database\Connection
类下面 $loggingQueries = true
属性是控制日志打印的选项,ORM 使用打印日志调用
// 允许打印日志
$Model->getConnection()->enableQueryLog()
// query
Log::Debug($Model->getConnection()->getQueryLog())
结果:
[
{
"query":"select * from `model` where `name` = ? order by `id` asc",
"bindings":[
"571df91d0efb3d99edad5193d85b9257ce70d1ebf41dbe985b9c5e0e684ef50f"
],
"time":3.81
}
]
猜你喜欢:
暂无回复。