Sortable
Sortable model trait
trait Winter\Storm\Database\Traits\Sortable
Usage:
Model table must have sort_order table column.
In the model class definition:
use \Winter\Storm\Database\Traits\Sortable;
To set orders:
$model->setSortableOrder($recordIds, $recordOrders);
You can change the sort field used by declaring:
const SORT_ORDER = 'my_sort_order';
Methods
public static bootSortable () : void
Boot the sortable trait for this model.
Returns
void
public getSortOrderColumn () : string
Get the name of the "sort order" column.
Returns
string
public
setSortableOrder (mixed $itemIds, array $itemOrders = null
)
: void
Sets the sort order of records to the specified orders. If the orders is undefined, the record identifier is used.
Parameters
Property | Type | Description |
---|---|---|
$itemIds | mixed |
mixed
|
$itemOrders | array |
array
|
Returns
void
Used by
← Previous page
Winter\Storm\Database\Traits\SoftDeleting
Next page →
Winter\Storm\Database\Traits\Validation
Copyright © 2024 Winter CMS