Sortable
trait Sortable
Sortable model trait
Usage:
Model table must have priority table column.
In the model class definition:
use \Igniter\Flame\Database\Traits\Sortable;
To set orders:
$model->setSortableOrder($recordIds, $recordOrders);
You can change the sort field used by declaring:
public $sortable [ 'sortOrderColumn' = 'priority', 'sortWhenCreating' = FALSE, ];
Methods
Boot the sortable trait for this model.
No description
Sets the sort order of records to the specified orders. If the orders is undefined, the record identifier is used.
Get the name of the "sort order" column.
No description
Details
at line 36
static void
bootSortable()
Boot the sortable trait for this model.
at line 48
scopeSorted($query)
No description
at line 62
setSortableOrder($itemIds, null $itemOrders = null)
Sets the sort order of records to the specified orders. If the orders is undefined, the record identifier is used.
at line 85
string
getSortOrderColumn()
Get the name of the "sort order" column.
at line 90
sortWhenCreating()
No description