Adldap\Laravel\AdldapServiceProvider::addProviders PHP Method

addProviders() protected method

Adds providers to the specified Adldap instance.
protected addProviders ( Adldap $adldap, array $connections = [] ) : Adldap
$adldap Adldap\Adldap
$connections array
return Adldap\Adldap
    protected function addProviders(Adldap $adldap, array $connections = [])
    {
        // Go through each connection and construct a Provider.
        collect($connections)->each(function ($settings, $name) use($adldap) {
            // Create a new provider.
            $provider = $this->newProvider($settings['connection_settings'], new $settings['connection'](), new $settings['schema']());
            // Try connecting to the provider if `auto_connect` is true.
            if (isset($settings['auto_connect']) && $settings['auto_connect'] === true) {
                $provider->connect();
            }
            // Add the provider to the Adldap container.
            $adldap->addProvider($provider, $name);
        });
        return $adldap;
    }