Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 4b15589

Browse files
committed
Show LDAP errors if application is set to debug mode
1 parent 16944a0 commit 4b15589

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/AdldapServiceProvider.php

+13-3
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,26 @@ public function register()
3636
{
3737
// Bind the Adldap instance to the IoC
3838
$this->app->bind('adldap', function () {
39-
$config = $this->app['config']->get('adldap');
39+
$config = $this->app['config'];
40+
41+
$settings = $config->get('adldap');
4042

4143
// Verify configuration.
42-
if (is_null($config)) {
44+
if (is_null($settings)) {
4345
$message = 'Adldap configuration could not be found. Try re-publishing using `php artisan vendor:publish --tag="adldap"`.';
4446

4547
throw new ConfigurationMissingException($message);
4648
}
4749

48-
return new Adldap($config['connection_settings'], new $config['connection'](), $config['auto_connect']);
50+
// Create a new Adldap instance.
51+
$ad = new Adldap($settings['connection_settings'], new $settings['connection'](), $config['auto_connect']);
52+
53+
if ($config->get('app.debug')) {
54+
// If the application is set to debug mode, we'll display LDAP error messages.
55+
$ad->getConnection()->showErrors();
56+
}
57+
58+
return $ad;
4959
});
5060

5161
// Bind the Adldap contract to the Adldap object

0 commit comments

Comments
 (0)