mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-28 19:06:39 +08:00
Made new pages in chapters have a better inital priority
This commit is contained in:
@ -136,6 +136,18 @@ class ChapterRepo extends EntityRepo
|
||||
return $slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new priority value for a new page to be added
|
||||
* to the given chapter.
|
||||
* @param Chapter $chapter
|
||||
* @return int
|
||||
*/
|
||||
public function getNewPriority(Chapter $chapter)
|
||||
{
|
||||
$lastPage = $chapter->pages->last();
|
||||
return $lastPage !== null ? $lastPage->priority + 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get chapters by the given search term.
|
||||
* @param string $term
|
||||
|
Reference in New Issue
Block a user