@@ -40,68 +40,35 @@ public function register(): void
40
40
41
41
public function offerPublishing (): void
42
42
{
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 ;
48
45
}
46
+
47
+ $ this ->publishes ([
48
+ __DIR__ . '/../config/repository.php ' => $ this ->app ->configPath ('repository.php ' ),
49
+ ], 'database-repository-config ' );
49
50
}
50
51
51
52
/**
52
53
* Register custom commands.
53
54
*/
54
55
private function registerCommands (): void
55
56
{
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 ;
104
59
}
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
+ ]);
105
72
}
106
73
107
74
}
0 commit comments