Laravel 5.3 “group by count”查询问题

Laravel 5.3 “group by count” query issues

拜托,我正在尝试 运行 原始 sql

中看起来像这样的查询
SELECT `qnty`, COUNT(*) FROM cartlist GROUP BY `pro_id`,`cart_id`,`price`

在 laravel.

我试过了

$count = DB::table('cartlist')
                 ->select(DB::raw('count(*) as qnty'))
                 ->where('pro_id', '$tt->pro_id')
                 ->where('cart_id', '$cart_id')
                 ->groupBy('pro_id','price')
                 ->get();

但是报如下错误

classIlluminate\Support\Collection 的对象无法转换为 int

$count = DB::table('cartlist') ->select(DB::raw('count(*) as qnty')) 
                               ->where('pro_id', '$tt->pro_id') 
                               ->where('cart_id', '$cart_id') 
                               ->groupBy('pro_id','price','cart_id') ->get();