Laravel Classroom image

Yasar  Khan / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10|Last
Lessons:-Fluent Query Builder

10.4 Ordering
Ordering is pretty important, you don’t wanna waste resources doing that with PHP. You could…
sure… lots of nasty array_sort()ing, tons of loops, that wouldn’t be any fun. Let’s pass this
responsibility to fluent.
1 <?php
2
3 DB::table('shoes')->order_by('size', 'asc')->get();
Hmm shoes? Women are meant to think about shoes but thats all that came to mind.. scarey.
Anyway its as easy as passing a field name and either asc for ascending, or desc for descending.
To sort on more columns simply repeat the order_by() chain.

 
 
 

Yasar  Khan

Skills    Laravel

Qualifications :-
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:- Hi i am yasar working as web developer since last 3 years.
Explore
 

  Students (0)