@php use App\Libraries\General; @endphp @foreach($listing as $key => $l)

{{$l['question']}}

{{date('d-m-Y',strtotime($l['end_date']))}}

{{$l['total_votes'] ? General::compactPriceFromat($l['total_votes']) : 0 }} Votes
@php $options = $l->options()->get(); $votes = $l->options()->pluck('votes')->toArray(); if($votes): $value = max($votes); $key = array_keys($votes, $value); if(count($key) > 2) $key = []; endif; $optionLoop = ['A','B','C','D','E','F']; @endphp @foreach($options as $okey => $o) @php if($l['total_votes'] && $o['votes']): $percent = $o['votes']/$l['total_votes']; $rating = $percent * 100; else: $rating = 0; endif; @endphp

{{$optionLoop[$okey]}}

{{$o['option']}}

{{round($rating)}}%

@endforeach
@endforeach