src/Builders/ControllerBuilder.php
public function compactBuilder()
    {
        if ($this->relationships == 0 && $this->enum == 0) {
            return '';
        } else {
            $compact = ', compact($RELATIONS$)';
            if ($this->relationships > 0) {
                $first = true;
                foreach ($this->fields as $field) {
                    if ($field->type == 'relationship') {
                        $toReplace = '';
                        if ($first != true) {
                            $toReplace .= ', ';
                        } else {
                            $first = false;
                        }
                        $toReplace .= '"' . $field->relationship_name . '"$RELATIONS$';
                        $compact = str_replace('$RELATIONS$', $toReplace, $compact);
                    }
                }
            }
            if ($this->enum > 0) {
                if (! isset($first)) {
                    $first = true;
                }
                foreach ($this->fields as $field) {
                    if ($field->type == 'enum') {
                        $toReplace = '';
                        if ($first != true) {
                            $toReplace .= ', ';
                        } else {
                            $first = false;
                        }
                        $toReplace .= '"' . $field->title . '"$RELATIONS$';
                        $compact = str_replace('$RELATIONS$', $toReplace, $compact);
                    }
                }
            }
            $compact = str_replace('$RELATIONS$', '', $compact);

            return $compact;
        }
    }
public function compactBuilder()
    {
        if ($this->relationships == 0 && $this->enum == 0) {
            return '';
        } else {
            $compact = ', compact($RELATIONS$)';
            if ($this->relationships > 0) {
                $first = true;
                foreach ($this->fields as $field) {
                    if ($field->type == 'relationship') {
                        $toReplace = '';
                        if ($first != true) {
                            $toReplace .= ', ';
                        } else {
                            $first = false;
                        }
                        $toReplace .= '"' . $field->relationship_name . '"$RELATIONS$';
                        $compact = str_replace('$RELATIONS$', $toReplace, $compact);
                    }
                }
            }
            if ($this->enum > 0) {
                if (! isset($first)) {
                    $first = true;
                }
                foreach ($this->fields as $field) {
                    if ($field->type == 'enum') {
                        $toReplace = '';
                        if ($first != true) {
                            $toReplace .= ', ';
                        } else {
                            $first = false;
                        }
                        $toReplace .= '"' . $field->title . '"$RELATIONS$';
                        $compact = str_replace('$RELATIONS$', $toReplace, $compact);
                    }
                }
            }
            $compact = str_replace('$RELATIONS$', '', $compact);

            return $compact;
        }
    }
public function compactBuilder ( ) { if ( $ this -> relationships == 0 && $ this -> enum == 0 ) { return '' ; } else { $ compact = ', compact($RELATIONS$)' ; if ( $ this -> relationships > 0 ) { $ first = true ; foreach ( $ this -> fields as $ field ) { if ( $ field -> type == 'relationship' ) { $ toReplace = '' ; if ( $ first != true ) { $ toReplace .= ', ' ; } else { $ first = false ; } $ toReplace .= '"' . $ field -> relationship_name . '"$RELATIONS$' ; $ compact = str_replace ( '$RELATIONS$' , $ toReplace , $ compact ) ; } } } if ( $ this -> enum > 0 ) { if ( ! isset ( $ first ) ) { $ first = true ; } foreach ( $ this -> fields as $ field ) { if ( $ field -> type == 'enum' ) { $ toReplace = '' ; if ( $ first != true ) { $ toReplace .= ', ' ; } else { $ first = false ; } $ toReplace .= '"' . $ field -> title . '"$RELATIONS$' ; $ compact = str_replace ( '$RELATIONS$' , $ toReplace , $ compact ) ; } } } $ compact = str_replace ( '$RELATIONS$' , '' , $ compact ) ; return $ compact ; } }
Build compact for create form
@return mixed|string
Build compact for create form