X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/c429cf78187e80deb63982a282a1c6889f30291a..refs/pull/3503/head:/app/Http/Controllers/Api/ChapterApiController.php diff --git a/app/Http/Controllers/Api/ChapterApiController.php b/app/Http/Controllers/Api/ChapterApiController.php index 13b3f9821..8459b8449 100644 --- a/app/Http/Controllers/Api/ChapterApiController.php +++ b/app/Http/Controllers/Api/ChapterApiController.php @@ -14,16 +14,16 @@ class ChapterApiController extends ApiController protected $rules = [ 'create' => [ - 'book_id' => 'required|integer', - 'name' => 'required|string|max:255', - 'description' => 'string|max:1000', - 'tags' => 'array', + 'book_id' => ['required', 'integer'], + 'name' => ['required', 'string', 'max:255'], + 'description' => ['string', 'max:1000'], + 'tags' => ['array'], ], 'update' => [ - 'book_id' => 'integer', - 'name' => 'string|min:1|max:255', - 'description' => 'string|max:1000', - 'tags' => 'array', + 'book_id' => ['integer'], + 'name' => ['string', 'min:1', 'max:255'], + 'description' => ['string', 'max:1000'], + 'tags' => ['array'], ], ]; @@ -70,7 +70,7 @@ class ChapterApiController extends ApiController public function read(string $id) { $chapter = Chapter::visible()->with(['tags', 'createdBy', 'updatedBy', 'ownedBy', 'pages' => function (HasMany $query) { - $query->visible()->get(['id', 'name', 'slug']); + $query->scopes('visible')->get(['id', 'name', 'slug']); }])->findOrFail($id); return response()->json($chapter);