Michael Andrew Michael Andrew - 1 month ago 18
PHP Question

ORDER BY in Gas ORM

I want to sorting data like order by Ascending and Descending in SQL. How to do it with Gas ORM?

This is my code that i have tried before:

$datas['all_datas'] = Model\Data::order_by('date')->all();


How to add sorting option like ascending and descending mode too?

Thank you

Answer

Try like this :

$datas['all_datas'] = Model\Data::order_by('date','desc')->all();