public function connection(?string $using, Closure $callback, array $options = []): void
    {
        $repository = $this->app->make('config');

        if (\is_null($using)) {
            $using = $repository->get('database.default');
        }

        $config = $repository->get("database.connections.{$using}", null);

        if (\is_null($config)) {
            throw new InvalidArgumentException("Database connection [{$using}] is not available.");
        }

        Arr::set($this->config, 'connection', [
            'name' => "{$using}_{id}",
            'template' => $config,
            'resolver' => $callback,
            'options' => $options,
        ]);
    }
public function connection(?string $using, Closure $callback, array $options = []): void
    {
        $repository = $this->app->make('config');

        if (\is_null($using)) {
            $using = $repository->get('database.default');
        }

        $config = $repository->get("database.connections.{$using}", null);

        if (\is_null($config)) {
            throw new InvalidArgumentException("Database connection [{$using}] is not available.");
        }

        Arr::set($this->config, 'connection', [
            'name' => "{$using}_{id}",
            'template' => $config,
            'resolver' => $callback,
            'options' => $options,
        ]);
    }
public function connection ( ? string $ using , Closure $ callback , array $ options = [ ] ) : void { $ repository = $ this -> app -> make ( 'config' ) ; if ( \ is_null ( $ using ) ) { $ using = $ repository -> get ( 'database.default' ) ; } $ config = $ repository -> get ( "database.connections.{$using}" , null ) ; if ( \ is_null ( $ config ) ) { throw new InvalidArgumentException ( "Database connection [{$using}] is not available." ) ; } Arr :: set ( $ this -> config , 'connection' , [ 'name' => "{$using}_{id}" , 'template' => $ config , 'resolver' => $ callback , 'options' => $ options , ] ) ; }
Setup multiple database connection from template.

@param  string|null  $using
@param  \Closure  $callback
@param  array  $option

@throws \InvalidArgumentException

@return void
Setup multiple database connection from template .