public function format($mode, $name, $data)
    {
        if ($mode === 'cast') {
            throw new InvalidArgumentException("Use `Schema::cast()` to perform casting.");
        }
        if (!isset($this->_columns[$name])) {
            // Formatting non defined columns or relations doesn't make sense, bailing out.
            return $this->convert($mode, '_default_', $data, []);
        }
        $column = $this->_columns[$name];
        $isNull = $data === null;
        $type = $isNull ? 'null' : $this->type($name);

        if (!$column['array']) {
            $data = $this->convert($mode, $type, $data, $column);
        } else {
            $data = Collection::format($mode, $data);
        }
        if (!$isNull && !empty($column['format'])) {
            $data = $this->convert($mode, $column['format'], $data, $column);
        }
        return $data;
    }