-<?php namespace BookStack\Entities\Repos;
+<?php
+
+namespace BookStack\Entities\Repos;
use BookStack\Actions\ActivityType;
use BookStack\Entities\Models\Book;
public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator
{
return Bookshelf::visible()
- ->with('visibleBooks')
+ ->with(['visibleBooks', 'cover'])
->orderBy($sort, $order)
->paginate($count);
}
$shelf = new Bookshelf();
$this->baseRepo->create($shelf, $input);
$this->updateBooks($shelf, $bookIds);
- Activity::addForEntity($shelf, ActivityType::BOOKSHELF_CREATE);
+ Activity::add(ActivityType::BOOKSHELF_CREATE, $shelf);
+
return $shelf;
}
$this->updateBooks($shelf, $bookIds);
}
- Activity::addForEntity($shelf, ActivityType::BOOKSHELF_UPDATE);
+ Activity::add(ActivityType::BOOKSHELF_UPDATE, $shelf);
+
return $shelf;
}
$syncData = Book::visible()
->whereIn('id', $bookIds)
- ->get(['id'])->pluck('id')->mapWithKeys(function ($bookId) use ($numericIDs) {
+ ->pluck('id')
+ ->mapWithKeys(function ($bookId) use ($numericIDs) {
return [$bookId => ['order' => $numericIDs->search($bookId)]];
});
/**
* Update the given shelf cover image, or clear it.
+ *
* @throws ImageUploadException
* @throws Exception
*/
/**
* Remove a bookshelf from the system.
+ *
* @throws Exception
*/
public function destroy(Bookshelf $shelf)
{
$trashCan = new TrashCan();
$trashCan->softDestroyShelf($shelf);
- Activity::addForEntity($shelf, ActivityType::BOOKSHELF_DELETE);
+ Activity::add(ActivityType::BOOKSHELF_DELETE, $shelf);
$trashCan->autoClearOld();
}
}