class ChapterRepo
{
- protected $baseRepo;
-
- /**
- * ChapterRepo constructor.
- */
- public function __construct(BaseRepo $baseRepo)
- {
- $this->baseRepo = $baseRepo;
+ public function __construct(
+ protected BaseRepo $baseRepo
+ ) {
}
/**
{
$chapter = new Chapter();
$chapter->book_id = $parentBook->id;
- $chapter->priority = $chapter->priority ?: (new BookContents($parentBook))->getLastPriority() + 1;
+ $chapter->priority = (new BookContents($parentBook))->getLastPriority() + 1;
$this->baseRepo->create($chapter, $input);
Activity::add(ActivityType::CHAPTER_CREATE, $chapter);