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

Commit 93d7278

Browse files
committed
Only register command and publish config when running in console
1 parent 845239d commit 93d7278

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

src/AdldapAuthServiceProvider.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,21 @@ class AdldapAuthServiceProvider extends ServiceProvider
2525
*/
2626
public function boot()
2727
{
28-
$config = __DIR__.'/Config/auth.php';
29-
30-
$this->publishes([
31-
$config => config_path('ldap_auth.php'),
32-
]);
33-
3428
// Register the lDAP auth provider.
3529
Auth::provider('ldap', function ($app, array $config) {
3630
return $this->makeUserProvider($app['hash'], $config);
3731
});
3832

39-
// Register the import command.
40-
$this->commands(Import::class);
33+
if ($this->app->runningInConsole()) {
34+
$config = __DIR__ . '/Config/auth.php';
35+
36+
$this->publishes([
37+
$config => config_path('ldap_auth.php'),
38+
]);
39+
40+
// Register the import command.
41+
$this->commands(Import::class);
42+
}
4143
}
4244

4345
/**

src/AdldapServiceProvider.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ public function boot()
3636
return;
3737
}
3838

39-
$config = __DIR__.'/Config/config.php';
39+
if ($this->app->runningInConsole()) {
40+
$config = __DIR__ . '/Config/config.php';
4041

41-
$this->publishes([
42-
$config => config_path('ldap.php'),
43-
]);
42+
$this->publishes([
43+
$config => config_path('ldap.php'),
44+
]);
45+
}
4446
}
4547

4648
/**
@@ -73,9 +75,7 @@ public function register()
7375
*/
7476
public function provides()
7577
{
76-
return [
77-
AdldapInterface::class,
78-
];
78+
return [AdldapInterface::class];
7979
}
8080

8181
/**

0 commit comments

Comments
 (0)