namespace BookStack\Http\Controllers;
-use Activity;
+use BookStack\Actions\ActivityQueries;
use BookStack\Actions\View;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Repos\BookshelfRepo;
{
$this->checkPermission('bookshelf-create-all');
$this->validate($request, [
- 'name' => 'required|string|max:255',
- 'description' => 'string|max:1000',
- 'image' => 'nullable|' . $this->getImageValidationRules(),
+ 'name' => ['required', 'string', 'max:255'],
+ 'description' => ['string', 'max:1000'],
+ 'image' => array_merge(['nullable'], $this->getImageValidationRules()),
]);
$bookIds = explode(',', $request->get('books', ''));
*
* @throws NotFoundException
*/
- public function show(string $slug)
+ public function show(ActivityQueries $activities, string $slug)
{
$shelf = $this->bookshelfRepo->getBySlug($slug);
$this->checkOwnablePermission('book-view', $shelf);
'shelf' => $shelf,
'sortedVisibleShelfBooks' => $sortedVisibleShelfBooks,
'view' => $view,
- 'activity' => Activity::entityActivity($shelf, 20, 1),
+ 'activity' => $activities->entityActivity($shelf, 20, 1),
'order' => $order,
'sort' => $sort,
]);
$shelf = $this->bookshelfRepo->getBySlug($slug);
$this->checkOwnablePermission('bookshelf-update', $shelf);
$this->validate($request, [
- 'name' => 'required|string|max:255',
- 'description' => 'string|max:1000',
- 'image' => 'nullable|' . $this->getImageValidationRules(),
+ 'name' => ['required', 'string', 'max:255'],
+ 'description' => ['string', 'max:1000'],
+ 'image' => array_merge(['nullable'], $this->getImageValidationRules()),
]);
$bookIds = explode(',', $request->get('books', ''));