dimanche 25 mars 2018

Arrange foreach loop in asc order (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="">
                                <img style="width:60px;vertical-align: middle;" src="">
                                
                            </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.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire