src/records/SortableTrait.php
protected function ensureSortOrder(
        array $sortOrderCondition = [],
        string $sortOrderAttribute = 'sortOrder'
    ) {
        if ($this->getAttribute($sortOrderAttribute) === null) {
            $this->setAttribute(
                $sortOrderAttribute,
                $this->nextSortOrder(
                    $sortOrderCondition,
                    $sortOrderAttribute
                )
            );
        }
    }
protected function ensureSortOrder(
        array $sortOrderCondition = [],
        string $sortOrderAttribute = 'sortOrder'
    ) {
        if ($this->getAttribute($sortOrderAttribute) === null) {
            $this->setAttribute(
                $sortOrderAttribute,
                $this->nextSortOrder(
                    $sortOrderCondition,
                    $sortOrderAttribute
                )
            );
        }
    }
protected function ensureSortOrder ( array $ sortOrderCondition = [ ] , string $ sortOrderAttribute = 'sortOrder' ) { if ( $ this -> getAttribute ( $ sortOrderAttribute ) === null ) { $ this -> setAttribute ( $ sortOrderAttribute , $ this -> nextSortOrder ( $ sortOrderCondition , $ sortOrderAttribute ) ) ; } }
Ensure a sort order is set.  If a sort order is not provided, it will be added to the end.

@param array $sortOrderCondition
@param string $sortOrderAttribute
Ensure a sort order is set . If a sort order is not provided it will be added to the end .