diff --git a/lib/classes/JsonApi/Routes/StockImages/StockImagesCreate.php b/lib/classes/JsonApi/Routes/StockImages/StockImagesCreate.php index 5c11a9e0466e03f294551478c99f00958037cf0c..50ebd55842efd77886844fc714ef2195a8e8e54f 100644 --- a/lib/classes/JsonApi/Routes/StockImages/StockImagesCreate.php +++ b/lib/classes/JsonApi/Routes/StockImages/StockImagesCreate.php @@ -25,9 +25,9 @@ class StockImagesCreate extends JsonApiController */ public function __invoke(Request $request, Response $response, $args): Response { - $json = $this->validate($request, $resource); + $json = $this->validate($request); $user = $this->getUser($request); - if (!Authority::canCreateStockImage($user, $resource)) { + if (!Authority::canCreateStockImage($user)) { throw new AuthorizationFailedException(); } $resource = $this->createResource($json); diff --git a/lib/classes/JsonApi/Routes/StockImages/StockImagesUpdate.php b/lib/classes/JsonApi/Routes/StockImages/StockImagesUpdate.php index cef9db5cac7eaa55206e12f7f57c8875f773ff85..e52370587a33d3c347a6c781c8836934b04a7840 100644 --- a/lib/classes/JsonApi/Routes/StockImages/StockImagesUpdate.php +++ b/lib/classes/JsonApi/Routes/StockImages/StockImagesUpdate.php @@ -84,7 +84,7 @@ class StockImagesUpdate extends JsonApiController } } - private function updateResource(StockImage $resource, array $json): void + private function updateResource(StockImage $resource, array $json): StockImage { $updates = array_merge( self::getAttributeUpdates($json, ['title', 'description', 'author', 'license']), @@ -92,5 +92,7 @@ class StockImagesUpdate extends JsonApiController ); $resource->setData($updates); $resource->store(); + + return $resource; } }