src/Validation/Spec/CreateResourceValidator.php
protected function validateAttributes(): bool
    {
        if (!$this->dataHas('attributes')) {
            return true;
        }

        $attrs = $this->dataGet('attributes');

        if (!is_object($attrs)) {
            $this->memberNotObject('/data', 'attributes');
            return false;
        }

        $disallowed = collect(['type', 'id'])->filter(function ($field) use ($attrs) {
            return property_exists($attrs, $field);
        });

        $this->memberFieldsNotAllowed('/data', 'attributes', $disallowed);

        return $disallowed->isEmpty();
    }
protected function validateAttributes(): bool
    {
        if (!$this->dataHas('attributes')) {
            return true;
        }

        $attrs = $this->dataGet('attributes');

        if (!is_object($attrs)) {
            $this->memberNotObject('/data', 'attributes');
            return false;
        }

        $disallowed = collect(['type', 'id'])->filter(function ($field) use ($attrs) {
            return property_exists($attrs, $field);
        });

        $this->memberFieldsNotAllowed('/data', 'attributes', $disallowed);

        return $disallowed->isEmpty();
    }
Validate the resource attributes.

@return bool