Laravel 查看SQL执行记录

1:
$results = ModelArticle::query()->where(['id' => 1])->toSql();
dd($results);

2:
\DB::listen(function($sql, $bindings, $time) {
    var_dump($sql);
    var_dump($bindings);
    var_dump($time);
});

3:
Install Laravel Debugbar
https://github.com/barryvdh/laravel-debugbar


ps: Laravel Eloquent ORM where 多条件查询
$goodsShow = Goods::where('cate_id','=',$cate_id)
    ->where(function($query){
        $query->where('status','<','61')
            ->orWhere(function($query){
                $query->where('status', '91');
            });
    })->first();