public function patch($parentUuid, $uuid, Request $request)
    {
        // Check parent exists
        $parentModel = static::$parentModel;
        $parentResource = $parentModel::findOrFail($parentUuid);

        // Authorize ability to update children models for parent
        $this->authorizeUserAction($this->parentAbilitiesRequired['update'], $parentResource);

        // Get resource
        $model = new static::$model;
        $resource = static::$model::findOrFail($uuid);

        // Check resource belongs to parent
        if ($resource->getAttribute(($parentResource->getKeyName())) != $parentResource->getKey()) {
            throw new AccessDeniedHttpException('Resource \'' . class_basename(static::$model) . '\' with given UUID ' . $uuid . ' does not belong to ' .
                'resource \'' . class_basename(static::$parentModel) . '\' with given UUID ' . $parentUuid . '; ');
        }

        $this->authorizeUserAction('update', $resource);

        // Validate the resource data with the updates
        $this->restfulService->validateResourceUpdate($resource, $request->input());

        // Patch model
        $this->restfulService->patch($resource, $request->input());

        // Get updated resource
        $resource = $model::with($model::$localWith)->where($model->getKeyName(), '=', $uuid)->first();

        if ($this->shouldTransform()) {
            $response = $this->response->item($resource, $this->getTransformer());
        } else {
            $response = $resource;
        }

        return $response;
    }
public function patch($parentUuid, $uuid, Request $request)
    {
        // Check parent exists
        $parentModel = static::$parentModel;
        $parentResource = $parentModel::findOrFail($parentUuid);

        // Authorize ability to update children models for parent
        $this->authorizeUserAction($this->parentAbilitiesRequired['update'], $parentResource);

        // Get resource
        $model = new static::$model;
        $resource = static::$model::findOrFail($uuid);

        // Check resource belongs to parent
        if ($resource->getAttribute(($parentResource->getKeyName())) != $parentResource->getKey()) {
            throw new AccessDeniedHttpException('Resource \'' . class_basename(static::$model) . '\' with given UUID ' . $uuid . ' does not belong to ' .
                'resource \'' . class_basename(static::$parentModel) . '\' with given UUID ' . $parentUuid . '; ');
        }

        $this->authorizeUserAction('update', $resource);

        // Validate the resource data with the updates
        $this->restfulService->validateResourceUpdate($resource, $request->input());

        // Patch model
        $this->restfulService->patch($resource, $request->input());

        // Get updated resource
        $resource = $model::with($model::$localWith)->where($model->getKeyName(), '=', $uuid)->first();

        if ($this->shouldTransform()) {
            $response = $this->response->item($resource, $this->getTransformer());
        } else {
            $response = $resource;
        }

        return $response;
    }
public function patch ( $ parentUuid , $ uuid , Request $ request ) { // Check parent exists $ parentModel = static :: $ parentModel ; $ parentResource = $ parentModel :: findOrFail ( $ parentUuid ) ; // Authorize ability to update children models for parent $ this -> authorizeUserAction ( $ this -> parentAbilitiesRequired [ 'update' ] , $ parentResource ) ; // Get resource $ model = new static :: $ model ; $ resource = static :: $ model :: findOrFail ( $ uuid ) ; // Check resource belongs to parent if ( $ resource -> getAttribute ( ( $ parentResource -> getKeyName ( ) ) ) != $ parentResource -> getKey ( ) ) { throw new AccessDeniedHttpException ( 'Resource \'' . class_basename ( static :: $ model ) . '\' with given UUID ' . $ uuid . ' does not belong to ' . 'resource \'' . class_basename ( static :: $ parentModel ) . '\' with given UUID ' . $ parentUuid . '; ' ) ; } $ this -> authorizeUserAction ( 'update' , $ resource ) ; // Validate the resource data with the updates $ this -> restfulService -> validateResourceUpdate ( $ resource , $ request -> input ( ) ) ; // Patch model $ this -> restfulService -> patch ( $ resource , $ request -> input ( ) ) ; // Get updated resource $ resource = $ model :: with ( $ model :: $ localWith ) -> where ( $ model -> getKeyName ( ) , '=' , $ uuid ) -> first ( ) ; if ( $ this -> shouldTransform ( ) ) { $ response = $ this -> response -> item ( $ resource , $ this -> getTransformer ( ) ) ; } else { $ response = $ resource ; } return $ response ; }
Request to update the specified child resource

@param string $parentUuid UUID of the parent resource
@param string $uuid UUID of the child resource
@param Request $request
@return \Dingo\Api\Http\Response
@throws HttpException
Request to update the specified child resource