如何从 table 中获取不同的值以及包含该值的行数

How do I get distinct values from the table along with the count of how many rows there are containing that value

IN SQL(如果可能,如何在 Laravel Eloquent 中写入),如果有 10 MySQL 行具有值 IN',则有 4 行具有值 'US',7 行具有值 'FR';我希望查询结果为三行:

  1. 输入 | 10
  2. 美国 | 4
  3. FR | 7
SELECT column_name, count(*) as c FROM table_name GROUP BY column_name ORDER BY c DESC
Model::query()->groupBy('country_name')->select('counrty_name',DB::raw('COUNT(1)'))->get()