88use Adldap \Contracts \Connections \ConnectionInterface ;
99use Adldap \Contracts \Schemas \SchemaInterface ;
1010use Adldap \Laravel \Exceptions \ConfigurationMissingException ;
11+ use Adldap \Schemas \Schema ;
1112use Illuminate \Contracts \Foundation \Application ;
1213use Illuminate \Support \ServiceProvider ;
1314
@@ -79,17 +80,21 @@ protected function addProviders(Adldap $adldap, array $connections = [])
7980 {
8081 // Go through each connection and construct a Provider.
8182 collect ($ connections )->each (function ($ settings , $ name ) use ($ adldap ) {
83+ // Set the default schema.
84+ Schema::set (new $ settings ['schema ' ]());
85+
86+ // Create a new provider.
8287 $ provider = $ this ->newProvider (
8388 $ settings ['connection_settings ' ],
84- new $ settings ['connection ' ](),
85- new $ settings ['schema ' ]()
89+ new $ settings ['connection ' ]()
8690 );
8791
92+ // Try connecting to the provider if `auto_connect` is true.
8893 if ($ settings ['auto_connect ' ] === true ) {
89- // Try connecting to the provider if `auto_connect` is true.
9094 $ provider ->connect ();
9195 }
9296
97+ // Add the provider to the Adldap container.
9398 $ adldap ->addProvider ($ name , $ provider );
9499 });
95100
@@ -111,12 +116,11 @@ protected function newAdldap()
111116 *
112117 * @param array $configuration
113118 * @param ConnectionInterface|null $connection
114- * @param SchemaInterface|null $schema
115119 *
116120 * @return Provider
117121 */
118- protected function newProvider ($ configuration = [], ConnectionInterface $ connection = null , SchemaInterface $ schema = null )
122+ protected function newProvider ($ configuration = [], ConnectionInterface $ connection = null )
119123 {
120- return new Provider ($ configuration , $ connection, $ schema );
124+ return new Provider ($ configuration , $ connection );
121125 }
122126}
0 commit comments