Answer the question
In order to leave comments, you need to log in
Group group by 'col' as 'value'?
$allVotes = DB::table('votes')
->select('voted_for', DB::raw('count(*) as value'))
->groupBy('voted_for', DB::raw('voted_for as value2'))
->get();
Answer the question
In order to leave comments, you need to log in
$allVotes = DB::table('votes')
->select('voted_for', DB::raw('count(*) as value'))
->groupBy('voted_for')
->get();
foreach ($allVotes as $key => $value) {
$value->label = $value->voted_for;
$value->highlight = 'rgba(255, 255, 255, .1)';
unset($value->voted_for);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question