DB::connection()->enableQueryLog(); // 开启查询日志
$sql = DB::table('xxx'); // 要查看的sql
$sql_msg = DB::getQueryLog(); // 获取查询日志
dd( $sql_msg );