classes/Models/Element.php
public function value()
    {

        // Must return a string
        if (empty($this->value)) {
            return '';
        }

        // Different outputs depending on type
        switch ($this->type) {
            case 'boolean': return !empty($this->value);
            case 'image': return $this->img()->url;
            case 'textarea': return nl2br($this->value);
            case 'wysiwyg': return Str::startsWith($this->value, '<') ? $this->value : "<p>{$this->value}</p>";
            case 'checkboxes': return explode(',', $this->value);
            case 'video-encoder': return $this->encoding('value')->tag;
            case 'model': return $this->relatedModel();
            default: return $this->value;
        }
    }
public function value()
    {

        // Must return a string
        if (empty($this->value)) {
            return '';
        }

        // Different outputs depending on type
        switch ($this->type) {
            case 'boolean': return !empty($this->value);
            case 'image': return $this->img()->url;
            case 'textarea': return nl2br($this->value);
            case 'wysiwyg': return Str::startsWith($this->value, '<') ? $this->value : "<p>{$this->value}</p>";
            case 'checkboxes': return explode(',', $this->value);
            case 'video-encoder': return $this->encoding('value')->tag;
            case 'model': return $this->relatedModel();
            default: return $this->value;
        }
    }
public function value ( ) { // Must return a string if ( empty ( $ this -> value ) ) { return '' ; } // Different outputs depending on type switch ( $ this -> type ) { case 'boolean' : return ! empty ( $ this -> value ) ; case 'image' : return $ this -> img ( ) -> url ; case 'textarea' : return nl2br ( $ this -> value ) ; case 'wysiwyg' : return Str :: startsWith ( $ this -> value , '<' ) ? $ this -> value : "<p>{$this->value}</p>" ; case 'checkboxes' : return explode ( ',' , $ this -> value ) ; case 'video-encoder' : return $ this -> encoding ( 'value' ) -> tag ; case 'model' : return $ this -> relatedModel ( ) ; default : return $ this -> value ; } }
Format the value before returning it based on the type

@return mixed Stringable
Format the value before returning it based on the type