Kodeine\Metable\Metable::__set PHP Method

__set() public method

public __set ( $key, $value )
    public function __set($key, $value)
    {
        // ignore the trait properties being set.
        if (starts_with($key, 'meta') || $key == 'query') {
            $this->{$key} = $value;
            return;
        }
        // if key is a model attribute, set as is
        if (array_key_exists($key, parent::getAttributes())) {
            parent::setAttribute($key, $value);
            return;
        }
        // if the key has a mutator execute it
        $mutator = camel_case('set_' . $key . '_meta');
        if (method_exists($this, $mutator)) {
            $this->{$mutator}($value);
            return;
        }
        // if key belongs to meta data, append its value.
        if ($this->metaData->has($key)) {
            /*if ( is_null($value) ) {
                  $this->metaData[$key]->markForDeletion();
                  return;
              }*/
            $this->metaData[$key]->value = $value;
            return;
        }
        // if model table has the column named to the key
        if (\Schema::hasColumn($this->getTable(), $key)) {
            parent::setAttribute($key, $value);
            return;
        }
        // key doesn't belong to model, lets create a new meta relationship
        //if ( ! is_null($value) ) {
        $this->setMetaString($key, $value);
        //}
    }