<?php namespace BookStack\Entities\Repos;
use BookStack\Actions\ActivityType;
-use BookStack\Entities\Book;
-use BookStack\Entities\Chapter;
-use BookStack\Entities\Managers\BookContents;
-use BookStack\Entities\Managers\TrashCan;
+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;
$chapter->book_id = $parentBook->id;
$chapter->priority = (new BookContents($parentBook))->getLastPriority() + 1;
$this->baseRepo->create($chapter, $input);
- Activity::add($chapter, ActivityType::CHAPTER_CREATE, $parentBook->id);
+ Activity::addForEntity($chapter, ActivityType::CHAPTER_CREATE);
return $chapter;
}
public function update(Chapter $chapter, array $input): Chapter
{
$this->baseRepo->update($chapter, $input);
- Activity::add($chapter, ActivityType::CHAPTER_UPDATE, $chapter->book->id);
+ Activity::addForEntity($chapter, ActivityType::CHAPTER_UPDATE);
return $chapter;
}
{
$trashCan = new TrashCan();
$trashCan->softDestroyChapter($chapter);
- Activity::add($chapter, ActivityType::CHAPTER_DELETE, $chapter->book->id);
+ Activity::addForEntity($chapter, ActivityType::CHAPTER_DELETE);
$trashCan->autoClearOld();
}
$chapter->changeBook($parent->id);
$chapter->rebuildPermissions();
- Activity::add($chapter, ActivityType::CHAPTER_MOVE, $parent->id);
+ Activity::addForEntity($chapter, ActivityType::CHAPTER_MOVE);
return $parent;
}