Skip to content

Commit af9e169

Browse files
committed
Register Command
1 parent 4bc0dea commit af9e169

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/DatabaseRepositoryServiceProvider.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,27 @@ class DatabaseRepositoryServiceProvider extends ServiceProvider
2828
*/
2929
public function boot()
3030
{
31-
$this->publishes([
32-
__DIR__ . '/Config/' . self::CONFIG_FILE => config_path(self::CONFIG_FILE),
33-
], 'config');
31+
if ($this->app->runningInConsole()) {
32+
$this->publishes([
33+
__DIR__ . '/Config/' . self::CONFIG_FILE => config_path(self::CONFIG_FILE),
34+
], 'config');
35+
36+
$this->register();
37+
}
3438
}
3539

3640
/**
3741
* Register the service provider.
3842
*/
39-
public function register()
43+
public function register(): void
4044
{
4145
$this->registerCommand();
4246
}
4347

4448
/**
4549
* Register custom commands.
4650
*/
47-
private function registerCommand()
51+
private function registerCommand(): void
4852
{
4953
$this->app->singleton('command.make-all-repository', function () {
5054
return new MakeAllRepository();
@@ -79,14 +83,14 @@ private function registerCommand()
7983
});
8084

8185
$this->commands([
82-
'command.make-all-repository',
83-
'command.make-entity',
84-
'command.make-factory',
85-
'command.make-interface-repository',
86-
'command.make-mysql-repository',
87-
'command.make-redis-repository',
88-
'command.make-repository',
89-
'command.make-resource'
86+
MakeAllRepository::class,
87+
MakeEntity::class,
88+
MakeFactory::class,
89+
MakeInterfaceRepository::class,
90+
MakeMySqlRepository::class,
91+
MakeRedisRepository::class,
92+
MakeRepository::class,
93+
MakeResource::class
9094
]);
9195
}
9296

0 commit comments

Comments
 (0)