public function buildModel($table, $baseModel, $describes, $foreignKeys, $namespace = '', $prefix = '')
    {
        $this->table = StringUtils::removePrefix($table, $prefix);
        $this->baseModel = $baseModel;
        $this->foreignKeys = $this->filterAndSeparateForeignKeys($foreignKeys['all'], $table);
        $foreignKeysByTable = $foreignKeys['ordered'];

        if (!empty($namespace)) {
            $this->namespace = ' namespace '.$namespace.';';
        }

        $this->class = StringUtils::prettifyTableName($table, $prefix);
        $this->timestampFields = $this->getTimestampFields($this->baseModel);

        $describe = $describes[$table];

        // main loop
        foreach ($describe as $field) {
            if ($this->isPrimaryKey($field)) {
                $this->primaryKey = $field->Field;
                $this->incrementing = $this->isIncrementing($field);
                continue;
            }

            if ($this->isTimestampField($field)) {
                $this->timestamps = true;
                continue;
            }

            if ($this->isDate($field)) {
                $this->dates[] = $field->Field;
            }

            if ($this->isHidden($field)) {
                $this->hidden[] = $field->Field;
                continue;
            }

            if ($this->isForeignKey($table, $field->Field)) {
                continue;
            }

            $this->fillable[] = $field->Field;
        }

        // relations
        $this->relations = new Relations(
            $table,
            $this->foreignKeys,
            $describes,
            $foreignKeysByTable,
            $prefix,
            $namespace
        );
    }