-<?php namespace BookStack\Entities\Repos;
+<?php
+
+namespace BookStack\Entities\Repos;
use BookStack\Actions\ActivityType;
-use BookStack\Entities\Book;
-use BookStack\Entities\Chapter;
+use BookStack\Entities\Models\Book;
+use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Tools\BookContents;
use BookStack\Entities\Tools\TrashCan;
use BookStack\Exceptions\MoveOperationException;
use BookStack\Exceptions\NotFoundException;
use BookStack\Facades\Activity;
use Exception;
-use Illuminate\Support\Collection;
class ChapterRepo
{
-
protected $baseRepo;
/**
/**
* Get a chapter via the slug.
+ *
* @throws NotFoundException
*/
public function getBySlug(string $bookSlug, string $chapterSlug): Chapter
$chapter->priority = (new BookContents($parentBook))->getLastPriority() + 1;
$this->baseRepo->create($chapter, $input);
Activity::addForEntity($chapter, ActivityType::CHAPTER_CREATE);
+
return $chapter;
}
{
$this->baseRepo->update($chapter, $input);
Activity::addForEntity($chapter, ActivityType::CHAPTER_UPDATE);
- return $chapter;
- }
- /**
- * Update the permissions of a chapter.
- */
- public function updatePermissions(Chapter $chapter, bool $restricted, Collection $permissions = null)
- {
- $this->baseRepo->updatePermissions($chapter, $restricted, $permissions);
+ return $chapter;
}
/**
* Remove a chapter from the system.
+ *
* @throws Exception
*/
public function destroy(Chapter $chapter)
/**
* Move the given chapter into a new parent book.
* The $parentIdentifier must be a string of the following format:
- * 'book:<id>' (book:5)
+ * 'book:<id>' (book:5).
+ *
* @throws MoveOperationException
*/
public function move(Chapter $chapter, string $parentIdentifier): Book