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.