src/Builders/ModelBuilder.php
public function enum()
    {
        $return = "\r\n";
        foreach ($this->fields as $field) {
            if ($field->type == 'enum') {
                $values      = '';
                $field->enum = explode(',', $field->enum);
                foreach ($field->enum as $val) {
                    // Remove first whitespace
                    if (strpos(substr($val, 0, 1), ' ') !== false) {
                        $len = strlen($val);
                        $val = substr($val, 1, $len);
                    }
                    $values .= '"' . $val . '" => "' . $val . '"';
                    if ($val != last($field->enum)) {
                        $values .= ', ';
                    }
                }
                $return .= '    public static $' . $field->title . ' = [' . $values . '];' . "\r\n";
            }
        }

        return $return;
    }
public function enum()
    {
        $return = "\r\n";
        foreach ($this->fields as $field) {
            if ($field->type == 'enum') {
                $values      = '';
                $field->enum = explode(',', $field->enum);
                foreach ($field->enum as $val) {
                    // Remove first whitespace
                    if (strpos(substr($val, 0, 1), ' ') !== false) {
                        $len = strlen($val);
                        $val = substr($val, 1, $len);
                    }
                    $values .= '"' . $val . '" => "' . $val . '"';
                    if ($val != last($field->enum)) {
                        $values .= ', ';
                    }
                }
                $return .= '    public static $' . $field->title . ' = [' . $values . '];' . "\r\n";
            }
        }

        return $return;
    }
public function enum ( ) { $ return = "\r\n" ; foreach ( $ this -> fields as $ field ) { if ( $ field -> type == 'enum' ) { $ values = '' ; $ field -> enum = explode ( ',' , $ field -> enum ) ; foreach ( $ field -> enum as $ val ) { // Remove first whitespace if ( strpos ( substr ( $ val , 0 , 1 ) , ' ' ) !== false ) { $ len = strlen ( $ val ) ; $ val = substr ( $ val , 1 , $ len ) ; } $ values .= '"' . $ val . '" => "' . $ val . '"' ; if ( $ val != last ( $ field -> enum ) ) { $ values .= ', ' ; } } $ return .= '    public static $' . $ field -> title . ' = [' . $ values . '];' . "\r\n" ; } } return $ return ; }
Generate enum model
@return string
Generate enum model