阅读(185) (9)

Laravel 8 groupByRaw

2021-07-07 09:14:22 更新

groupByRaw 方法可以用于将原生字符串设置为 group by 语句的值:

$orders = DB::table('orders')
                ->select('city', 'state')
                ->groupByRaw('city, state')
                ->get();