public function setValue(Model $model)
    {
        if ($this->relation) {
            if (!$relationValue = $model->{$this->relation}) {
                return $this;
            }

            $this->value = $relationValue;
        } else {
            $this->value = $model->getAttribute($this->name);
        }

        return $this;
    }
public function setValue(Model $model)
    {
        if ($this->relation) {
            if (!$relationValue = $model->{$this->relation}) {
                return $this;
            }

            $this->value = $relationValue;
        } else {
            $this->value = $model->getAttribute($this->name);
        }

        return $this;
    }
public function setValue ( Model $ model ) { if ( $ this -> relation ) { if ( ! $ relationValue = $ model -> { $ this -> relation } ) { return $ this ; } $ this -> value = $ relationValue ; } else { $ this -> value = $ model -> getAttribute ( $ this -> name ) ; } return $ this ; }
Set value for this field.

@param Model $model

@return $this
Set value for this field .