How do I arrange a foreach loop in ascending order with Laravel? Here's my current code:
<h2 class="title">Top Performing Schools</h2>
@foreach($sch as $sch)
<div class="sch">
<div class="sch-content">
<a href="{{$sch->url}}">
<img style="width:60px;vertical-align: middle;" src="{{asset('images/'.$sch->logo)}}">
{{$sch->name}}
</a>
</div>
</div>
@endforeach
My guess is that $result = $result->orderBy('ranking_philippines', 'asc');
has to be put somewhere. ranking_philippines
is the database field that contains the ranking data that I want the items to be sorted by.