PHP Interface Spatie\EloquentSortable\Sortable

Mostra file Open project: spatie/eloquent-sortable

Public Methods

Method Description
scopeOrdered ( Builder $query ) : Builder Let's be nice and provide an ordered scope.
setHighestOrderNumber ( ) Modify the order column value.
setNewOrder ( array | ArrayAccess $ids, integer $startOrder = 1 ) This function reorders the records: the record with the first id in the array will get order 1, the record with the second it will get order 2,.
shouldSortWhenCreating ( ) : boolean Determine if the order column should be set when saving a new model instance.

Method Details

scopeOrdered() public method

Let's be nice and provide an ordered scope.
public scopeOrdered ( Builder $query ) : Builder
$query Illuminate\Database\Eloquent\Builder
return Illuminate\Database\Query\Builder

setHighestOrderNumber() public method

Modify the order column value.

setNewOrder() public static method

..
public static setNewOrder ( array | ArrayAccess $ids, integer $startOrder = 1 )
$ids array | ArrayAccess
$startOrder integer

shouldSortWhenCreating() public method

Determine if the order column should be set when saving a new model instance.
public shouldSortWhenCreating ( ) : boolean
return boolean