@@ -40,68 +40,35 @@ public function register(): void
4040
4141 public function offerPublishing (): void
4242 {
43- if ($ this ->app ->runningInConsole ()) {
44- $ this ->publishes ([
45- __DIR__ . '/../config/repository.php ' => $ this ->app ->configPath ('repository.php ' ),
46- ], 'database-repository-config ' );
47-
43+ if ($ this ->app ->runningInConsole () === false ) {
44+ return ;
4845 }
46+
47+ $ this ->publishes ([
48+ __DIR__ . '/../config/repository.php ' => $ this ->app ->configPath ('repository.php ' ),
49+ ], 'database-repository-config ' );
4950 }
5051
5152 /**
5253 * Register custom commands.
5354 */
5455 private function registerCommands (): void
5556 {
56- if ($ this ->app ->runningInConsole ()) {
57- $ this ->app ->singleton ('repository.make-all-repository ' , function () {
58- return new MakeAll ();
59- });
60-
61- $ this ->app ->singleton ('repository.make-entity ' , function () {
62- return new MakeEntity ();
63- });
64-
65- $ this ->app ->singleton ('repository.make-enum ' , function () {
66- return new MakeEnum ();
67- });
68-
69- $ this ->app ->singleton ('repository.make-factory ' , function () {
70- return new MakeFactory ();
71- });
72-
73- $ this ->app ->singleton ('repository.make-interface-repository ' , function () {
74- return new MakeInterfaceRepository ();
75- });
76-
77- $ this ->app ->singleton ('repository.make-mysql-repository ' , function () {
78- return new MakeMySqlRepository ();
79- });
80-
81- $ this ->app ->singleton ('repository.make-redis-repository ' , function () {
82- return new MakeRedisRepository ();
83- });
84-
85- $ this ->app ->singleton ('repository.make-repository ' , function () {
86- return new MakeRepository ();
87- });
88-
89- $ this ->app ->singleton ('repository.make-resource ' , function () {
90- return new MakeResource ();
91- });
92-
93- $ this ->commands ([
94- MakeAll::class,
95- MakeEntity::class,
96- MakeEnum::class,
97- MakeFactory::class,
98- MakeInterfaceRepository::class,
99- MakeMySqlRepository::class,
100- MakeRedisRepository::class,
101- MakeRepository::class,
102- MakeResource::class
103- ]);
57+ if ($ this ->app ->runningInConsole () === false ) {
58+ return ;
10459 }
60+
61+ $ this ->commands ([
62+ MakeAll::class,
63+ MakeEntity::class,
64+ MakeEnum::class,
65+ MakeFactory::class,
66+ MakeInterfaceRepository::class,
67+ MakeMySqlRepository::class,
68+ MakeRedisRepository::class,
69+ MakeRepository::class,
70+ MakeResource::class
71+ ]);
10572 }
10673
10774}
0 commit comments