$ratings = Rating::select('rating', DB::raw('count(id) as count')) ->groupBy('rating') ->get();
$total =$ratings->sum('count');
@foreach($ratings as $rating) Percentage: {{ ($rating->count / 100) * $total); }} @endforeach