class BookController extends Controller
{
- protected BookRepo $bookRepo;
- protected ShelfContext $shelfContext;
- protected ReferenceFetcher $referenceFetcher;
-
- public function __construct(ShelfContext $entityContextManager, BookRepo $bookRepo, ReferenceFetcher $referenceFetcher)
- {
- $this->bookRepo = $bookRepo;
- $this->shelfContext = $entityContextManager;
- $this->referenceFetcher = $referenceFetcher;
+ public function __construct(
+ protected ShelfContext $shelfContext,
+ protected BookRepo $bookRepo,
+ protected ReferenceFetcher $referenceFetcher
+ ) {
}
/**
{
$this->checkPermission('book-create-all');
$validated = $this->validate($request, [
- 'name' => ['required', 'string', 'max:255'],
- 'description' => ['string', 'max:1000'],
- 'image' => array_merge(['nullable'], $this->getImageValidationRules()),
- 'tags' => ['array'],
+ 'name' => ['required', 'string', 'max:255'],
+ 'description_html' => ['string', 'max:2000'],
+ 'image' => array_merge(['nullable'], $this->getImageValidationRules()),
+ 'tags' => ['array'],
+ 'default_template_id' => ['nullable', 'integer'],
]);
$bookshelf = null;
'bookParentShelves' => $bookParentShelves,
'watchOptions' => new UserEntityWatchOptions(user(), $book),
'activity' => $activities->entityActivity($book, 20, 1),
- 'referenceCount' => $this->referenceFetcher->getPageReferenceCountToEntity($book),
+ 'referenceCount' => $this->referenceFetcher->getReferenceCountToEntity($book),
]);
}
$this->checkOwnablePermission('book-update', $book);
$validated = $this->validate($request, [
- 'name' => ['required', 'string', 'max:255'],
- 'description' => ['string', 'max:1000'],
- 'image' => array_merge(['nullable'], $this->getImageValidationRules()),
- 'tags' => ['array'],
+ 'name' => ['required', 'string', 'max:255'],
+ 'description_html' => ['string', 'max:2000'],
+ 'image' => array_merge(['nullable'], $this->getImageValidationRules()),
+ 'tags' => ['array'],
+ 'default_template_id' => ['nullable', 'integer'],
]);
if ($request->has('image_reset')) {