public static function flatten($array)
    {
        $is_assoc = Arr::isAssoc($array);

        $flat = [];
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $flat = array_merge($flat, Arr::flatten($value));
            } else {
                if ($is_assoc) {
                    $flat[$key] = $value;
                } else {
                    $flat[] = $value;
                }
            }
        }

        return $flat;
    }