mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-31 15:24:31 +03:00
Aligned item creation wording and updated shelf-book-add logic
This commit is contained in:
@ -577,6 +577,21 @@ class EntityRepo
|
||||
$shelf->books()->sync($syncData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a Book to a BookShelf.
|
||||
* @param Bookshelf $shelf
|
||||
* @param Book $book
|
||||
*/
|
||||
public function appendBookToShelf(Bookshelf $shelf, Book $book)
|
||||
{
|
||||
if ($shelf->contains($book)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$maxOrder = $shelf->books()->max('order');
|
||||
$shelf->books()->attach($book->id, ['order' => $maxOrder + 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the book that an entity belongs to.
|
||||
* @param string $type
|
||||
|
Reference in New Issue
Block a user