DB::connection()->enableQueryLog();
sql语句
Log::info(DB::getQueryLog());die;
模型里面 $model->toSql(); 获取原生sql
DB 执行原生
$list = DB::table('shop_article')->leftjoin('shop_article_tag', 'shop_article.id', '=', 'shop_article_tag.article_id')->where($where)->select('shop_article.id','shop_article.title','shop_article.content','shop_article.file','shop_article.cover_map','shop_article.add_time',DB::raw('group_concat(shop_article_tag.`name`) as tag_name'))->groupBy('shop_article.id')->paginate($perpage);