[英]Operation count different id's
你只得到结果 1 因为你在查询中使用了这个where('dia_id', $request->id)
,如果你想计算 rrpp=1 使用这个查询:
$variable = Modelo::where('rrpp' , 1)->count('id');
如果你想计算所有 rrpp 使用这个查询:
$variable = Modelo::select('rrpp',
DB::raw('count(*) as total'))
->groupBy('rrpp')
->get()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.