private function getDatabaseInstance($id = null)
    {
        $config = App::getOption('db');
        $Database = 'Josantonius\\Database\\Database';

        if (! class_exists($Database) || ! is_array($config)) {
            return;
        }

        $id = $id ?: array_keys($config)[0];

        $required = ['provider', 'host', 'user', 'name', 'password', 'settings'];

        if (! array_diff($required, array_keys($config[$id]))) {
            $this->db = $Database::getConnection(
                $id,
                $config[$id]['provider'],
                $config[$id]['host'],
                $config[$id]['user'],
                $config[$id]['name'],
                $config[$id]['password'],
                $config[$id]['settings']
            );
        }
    }