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

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

        $resource = static::$model::findOrFail($uuid);

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

        // 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 . '; ');
        }

        $deletedCount = $resource->delete();

        if ($deletedCount < 1) {
            throw new NotFoundHttpException('Could not find a resource with that UUID to delete');
        }

        return $this->response->noContent()->setStatusCode(204);
    }
public function delete($parentUuid, $uuid)
    {
        // Check parent exists
        $parentModel = static::$parentModel;
        $parentResource = $parentModel::findOrFail($parentUuid);

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

        $resource = static::$model::findOrFail($uuid);

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

        // 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 . '; ');
        }

        $deletedCount = $resource->delete();

        if ($deletedCount < 1) {
            throw new NotFoundHttpException('Could not find a resource with that UUID to delete');
        }

        return $this->response->noContent()->setStatusCode(204);
    }
public function delete ( $ parentUuid , $ uuid ) { // Check parent exists $ parentModel = static :: $ parentModel ; $ parentResource = $ parentModel :: findOrFail ( $ parentUuid ) ; // Authorize ability to delete children model for parent $ this -> authorizeUserAction ( $ this -> parentAbilitiesRequired [ 'delete' ] , $ parentResource ) ; $ resource = static :: $ model :: findOrFail ( $ uuid ) ; $ this -> authorizeUserAction ( 'delete' , $ resource ) ; // 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 . '; ' ) ; } $ deletedCount = $ resource -> delete ( ) ; if ( $ deletedCount < 1 ) { throw new NotFoundHttpException ( 'Could not find a resource with that UUID to delete' ) ; } return $ this -> response -> noContent ( ) -> setStatusCode ( 204 ) ; }
Deletes a child resource by UUID

@param string $parentUuid UUID of the parent resource
@param string $uuid UUID of the child resource
@return \Dingo\Api\Http\Response
@throws HttpException
Deletes a child resource by UUID