-<?php namespace BookStack\Entities\Repos;
+<?php
+
+namespace BookStack\Entities\Repos;
use BookStack\Actions\ActivityType;
use BookStack\Entities\Models\Book;
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;
}
/**
* 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