@php $poll = $getRecord(); $options = $poll->options ?? []; $totalVotes = $poll->votes()->count(); $optionCounts = array_fill(0, count($options), 0); $allSelections = $poll->votes()->pluck('selected_options'); foreach ($allSelections as $selections) { foreach ($selections as $optionIndex) { if (isset($optionCounts[$optionIndex])) { $optionCounts[$optionIndex]++; } } } // Find the leading option $maxVotes = count($optionCounts) > 0 ? max($optionCounts) : 0; @endphp
No votes have been cast yet.
@else