I need help with a query that calculates the count based on conditions for genders "male" and "female".
$users[] = User::whereIn('gender',array('male', 'female'))->count()->get();
return view('/',compact('users[]'));
The counts are then displayed in a bar chart.
function drawStacked() {
var genders[] = {{ $users[] }}
var data = google.visualization.arrayToDataTable([
['Element', '', { role: 'style' }, { role: 'annotation' } ],
['Male', '#000', genders[0]],
['Female', '#000', genders[1]],
]);
}
However, only the count of gender male is being shown.