public static function instance($name = null)
{
if (empty($name)) {
$name = static::config('default', 'Local');
}
if (isset(static::$instances[$name])) {
return static::$instances[$name];
}
$adapter = static::adapter($name);
$instance = new static();
$instance->setAdapter($adapter);
static::$instances[$name] = $instance;
return $instance;
}