@@ -31,65 +31,65 @@ public function boot()
3131 } elseif ($ this ->app instanceof LumenApplication) {
3232 $ this ->app ->configure ('repository ' );
3333 }
34-
35- $ this ->registerCommand ();
3634 }
3735
3836 /**
3937 * Register the service provider.
4038 */
4139 public function register (): void
4240 {
43-
41+ $ this -> registerCommands ();
4442 }
4543
4644 /**
4745 * Register custom commands.
4846 */
49- private function registerCommand (): void
47+ private function registerCommands (): void
5048 {
51- $ this ->app ->singleton ('command.make-all-repository ' , function () {
52- return new MakeAllRepository ();
53- });
54-
55- $ this ->app ->singleton ('command.make-entity ' , function () {
56- return new MakeEntity ();
57- });
58-
59- $ this ->app ->singleton ('command.make-factory ' , function () {
60- return new MakeFactory ();
61- });
62-
63- $ this ->app ->singleton ('command.make-interface-repository ' , function () {
64- return new MakeInterfaceRepository ();
65- });
66-
67- $ this ->app ->singleton ('command.make-mysql-repository ' , function () {
68- return new MakeMySqlRepository ();
69- });
70-
71- $ this ->app ->singleton ('command.make-redis-repository ' , function () {
72- return new MakeRedisRepository ();
73- });
74-
75- $ this ->app ->singleton ('command.make-repository ' , function () {
76- return new MakeRepository ();
77- });
78-
79- $ this ->app ->singleton ('command.make-resource ' , function () {
80- return new MakeResource ();
81- });
82-
83- $ this ->commands ([
84- MakeAllRepository::class,
85- MakeEntity::class,
86- MakeFactory::class,
87- MakeInterfaceRepository::class,
88- MakeMySqlRepository::class,
89- MakeRedisRepository::class,
90- MakeRepository::class,
91- MakeResource::class
92- ]);
49+ if ($ this ->app ->runningInConsole ()) {
50+ $ this ->app ->singleton ('command.make-all-repository ' , function () {
51+ return new MakeAllRepository ();
52+ });
53+
54+ $ this ->app ->singleton ('command.make-entity ' , function () {
55+ return new MakeEntity ();
56+ });
57+
58+ $ this ->app ->singleton ('command.make-factory ' , function () {
59+ return new MakeFactory ();
60+ });
61+
62+ $ this ->app ->singleton ('command.make-interface-repository ' , function () {
63+ return new MakeInterfaceRepository ();
64+ });
65+
66+ $ this ->app ->singleton ('command.make-mysql-repository ' , function () {
67+ return new MakeMySqlRepository ();
68+ });
69+
70+ $ this ->app ->singleton ('command.make-redis-repository ' , function () {
71+ return new MakeRedisRepository ();
72+ });
73+
74+ $ this ->app ->singleton ('command.make-repository ' , function () {
75+ return new MakeRepository ();
76+ });
77+
78+ $ this ->app ->singleton ('command.make-resource ' , function () {
79+ return new MakeResource ();
80+ });
81+
82+ $ this ->commands ([
83+ MakeAllRepository::class,
84+ MakeEntity::class,
85+ MakeFactory::class,
86+ MakeInterfaceRepository::class,
87+ MakeMySqlRepository::class,
88+ MakeRedisRepository::class,
89+ MakeRepository::class,
90+ MakeResource::class
91+ ]);
92+ }
9393 }
9494
9595}
0 commit comments