protected function addColumn($field)
    {
        // Let's see if they're setting
        // a limit, like: string[50]
        if ( str_contains($field->type, '[') )
        {
            preg_match('/([^\[]+?)\[(\d+)\]/', $field->type, $matches);
            $field->type = $matches[1]; // string
            $field->limit = $matches[2]; // 50
        }

        // We'll start building the appropriate Schema method
        $html = "\$table->{$field->type}";

        $html .= isset($field->limit)
            ? "('{$field->name}', {$field->limit})"
            : "('{$field->name}')";

        // Take care of any potential indexes or options
        if (isset($field->options))
        {
            $html .= $field->options;
        }

        return $html.';';
    }
protected function addColumn($field)
    {
        // Let's see if they're setting
        // a limit, like: string[50]
        if ( str_contains($field->type, '[') )
        {
            preg_match('/([^\[]+?)\[(\d+)\]/', $field->type, $matches);
            $field->type = $matches[1]; // string
            $field->limit = $matches[2]; // 50
        }

        // We'll start building the appropriate Schema method
        $html = "\$table->{$field->type}";

        $html .= isset($field->limit)
            ? "('{$field->name}', {$field->limit})"
            : "('{$field->name}')";

        // Take care of any potential indexes or options
        if (isset($field->options))
        {
            $html .= $field->options;
        }

        return $html.';';
    }
protected function addColumn ( $ field ) { // Let's see if they're setting // a limit, like: string[50] if ( str_contains ( $ field -> type , '[' ) ) { preg_match ( '/([^\[]+?)\[(\d+)\]/' , $ field -> type , $ matches ) ; $ field -> type = $ matches [ 1 ] ; // string $ field -> limit = $ matches [ 2 ] ; // 50 } // We'll start building the appropriate Schema method $ html = "\$table->{$field->type}" ; $ html .= isset ( $ field -> limit ) ? "('{$field->name}', {$field->limit})" : "('{$field->name}')" ; // Take care of any potential indexes or options if ( isset ( $ field -> options ) ) { $ html .= $ field -> options ; } return $ html . ';' ; }
Return template string for adding a column

@param string $field
@return string
Return template string for adding a column