src/Resources/DbSchemaResource.php
public function createField($table, $field, $properties = [], $check_exist = false, $return_schema = false)
    {
        $properties = (is_array($properties) ? $properties : []);
        $properties['name'] = $field;

        $fields = static::validateAsArray($properties, null, true, 'Bad data format in request.');

        $tables = [['name' => $table, 'field' => $fields]];
        $result = $this->updateSchema($tables, !$check_exist);
        $result = array_get(array_get($result, 0, []), 'field', []);

        //  Any changes here should refresh cached schema
        $this->refreshCachedTables();

        if ($return_schema) {
            return $this->describeField($table, $field);
        }

        return $result;
    }
public function createField($table, $field, $properties = [], $check_exist = false, $return_schema = false)
    {
        $properties = (is_array($properties) ? $properties : []);
        $properties['name'] = $field;

        $fields = static::validateAsArray($properties, null, true, 'Bad data format in request.');

        $tables = [['name' => $table, 'field' => $fields]];
        $result = $this->updateSchema($tables, !$check_exist);
        $result = array_get(array_get($result, 0, []), 'field', []);

        //  Any changes here should refresh cached schema
        $this->refreshCachedTables();

        if ($return_schema) {
            return $this->describeField($table, $field);
        }

        return $result;
    }
Create a single table field by name and additional properties

@param string $table
@param string $field
@param array  $properties
@param bool   $check_exist
@param bool   $return_schema Return a refreshed copy of the schema from the database
@return array|mixed
@throws BadRequestException
@throws \Exception