$topics = Topic::with('user:id,username')->get();
记录 sql 查询日记
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
\DB::listen(function($query) {
\Log::debug([
'sql' => $query->sql,
'bindings' => $query->bindings,
'time' => $query->time,
'complete' => str_replace_array('?', $query->bindings, $query->sql)
]);
});
}
}
假数据 Faker 指定中文,修改 config/app.php
'faker_locale' => 'zh_CN',