order_by
Sorts a table by one or more columns in ascending or descending order.
Syntax
order_by(<table>, <columns>)
| Parameter | Type | Description |
|---|---|---|
| table | Table | The table to operate on. |
| columns | Array | The Columns value. |
Return values
Table
Usage
Sorts orders by creation date in descending order (newest first).
order_by(orders, orders.created_at desc)