src/ResourceValidationsTrait.php
protected function validateImmutable($field, $val, $required = true)
    {
        if ($this->getInitial($field) && $this->valueDiffersFromInitial($field, $val)) {
            $this->setError($field, 'immutable', [
                "title" => "`$field` is Immutable",
                "detail" => "You can't change the `$field` field of this resource once it's been set.",
            ]);
            return false;
        } else {
            $this->clearError($field, 'immutable');
            return true;
        }
    }
protected function validateImmutable($field, $val, $required = true)
    {
        if ($this->getInitial($field) && $this->valueDiffersFromInitial($field, $val)) {
            $this->setError($field, 'immutable', [
                "title" => "`$field` is Immutable",
                "detail" => "You can't change the `$field` field of this resource once it's been set.",
            ]);
            return false;
        } else {
            $this->clearError($field, 'immutable');
            return true;
        }
    }
protected function validateImmutable ( $ field , $ val , $ required = true ) { if ( $ this -> getInitial ( $ field ) && $ this -> valueDiffersFromInitial ( $ field , $ val ) ) { $ this -> setError ( $ field , 'immutable' , [ "title" => "`$field` is Immutable" , "detail" => "You can't change the `$field` field of this resource once it's been set." , ] ) ; return false ; } else { $ this -> clearError ( $ field , 'immutable' ) ; return true ; } }
Validates that the given value has not been changed since the first time it was set

@param string $field The name of the field (attribute or relationship) being validated
@param mixed $val The value to validate
@param bool $required Whether or not the resource is required (this affects how `null` is handled)
@return bool Whether or not the validation has passed
Validates that the given value has not been changed since the first time it was set