-
- /**
- * Common actions to run on bookshelf update.
- * @param Bookshelf $shelf
- * @param Request $request
- * @throws \BookStack\Exceptions\ImageUploadException
- */
- protected function shelfUpdateActions(Bookshelf $shelf, Request $request)
- {
- // Update the books that the shelf references
- $this->entityRepo->updateShelfBooks($shelf, $request->get('books', ''));
-
- // Update the cover image if in request
- if ($request->has('image')) {
- $newImage = $request->file('image');
- $this->imageRepo->destroyImage($shelf->cover);
- $image = $this->imageRepo->saveNew($newImage, 'cover_shelf', $shelf->id, 512, 512, true);
- $shelf->image_id = $image->id;
- $shelf->save();
- }
-
- if ($request->has('image_reset')) {
- $this->imageRepo->destroyImage($shelf->cover);
- $shelf->image_id = 0;
- $shelf->save();
- }
- }