- /**
- * Regenerate the permission for an entity.
- */
- protected function regenEntityPermissions(Entity $entity): void
- {
- $entity->rebuildPermissions();
- $entity->load('jointPermissions');
- }
-
- /**
- * Create and return a new bookshelf.
- */
- public function newShelf(array $input = ['name' => 'test shelf', 'description' => 'My new test shelf']): Bookshelf
- {
- return app(BookshelfRepo::class)->create($input, []);
- }
-
- /**
- * Create and return a new book.
- */
- public function newBook(array $input = ['name' => 'test book', 'description' => 'My new test book']): Book
- {
- return app(BookRepo::class)->create($input);
- }
-
- /**
- * Create and return a new test chapter.
- */
- public function newChapter(array $input, Book $book): Chapter
- {
- return app(ChapterRepo::class)->create($input, $book);
- }
-
- /**
- * Create and return a new test page.
- */
- public function newPage(array $input = ['name' => 'test page', 'html' => 'My new test page']): Page
- {
- $book = Book::query()->first();
- $pageRepo = app(PageRepo::class);
- $draftPage = $pageRepo->getNewDraftPage($book);
-
- return $pageRepo->publishDraft($draftPage, $input);
- }
-