Place an usort
function after the first iteration’s start point and you will get the sorted bookTimes
in the second iteration.
<div class="row">
@if(!empty($Service) && count($Service))
@foreach($Service['result'] as $value)
<?php
usort( $value, function ( $a, $b )
{
//$b should come first as you want to sort in descending order
return $b['bookedTimes'] <=> $a['bookedTimes'];
});
?>
@foreach($value as $val)
@endforeach
@endforeach
@else
<div class="col-lg-12 col-md-12"><h4>Data Not Found! </h4> </div>
@endif
</div>
CLICK HERE to find out more related problems solutions.