X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/06b500984250f75b98f38a8f25ac953cb45aeee4..refs/pull/3373/head:/app/Http/Controllers/Api/BookshelfApiController.php diff --git a/app/Http/Controllers/Api/BookshelfApiController.php b/app/Http/Controllers/Api/BookshelfApiController.php index de7284e61..63275a72a 100644 --- a/app/Http/Controllers/Api/BookshelfApiController.php +++ b/app/Http/Controllers/Api/BookshelfApiController.php @@ -11,21 +11,20 @@ use Illuminate\Validation\ValidationException; class BookshelfApiController extends ApiController { - /** - * @var BookshelfRepo - */ - protected $bookshelfRepo; + protected BookshelfRepo $bookshelfRepo; protected $rules = [ 'create' => [ 'name' => ['required', 'string', 'max:255'], 'description' => ['string', 'max:1000'], 'books' => ['array'], + 'tags' => ['array'], ], 'update' => [ 'name' => ['string', 'min:1', 'max:255'], 'description' => ['string', 'max:1000'], 'books' => ['array'], + 'tags' => ['array'], ], ]; @@ -75,7 +74,7 @@ class BookshelfApiController extends ApiController $shelf = Bookshelf::visible()->with([ 'tags', 'cover', 'createdBy', 'updatedBy', 'ownedBy', 'books' => function (BelongsToMany $query) { - $query->visible()->get(['id', 'name', 'slug']); + $query->scopes('visible')->get(['id', 'name', 'slug']); }, ])->findOrFail($id);