@@ -23,10 +23,10 @@ public function boot()
23
23
24
24
if ($ this ->app ->runningInConsole ()) {
25
25
$ this ->commands ([
26
- ' command.deploy-commands.install ' ,
27
- ' command.deploy-commands.make ' ,
28
- ' command.deploy-commands.run ' ,
29
- ' command.deploy-commands.mark '
26
+ InstallCommand::class ,
27
+ MakeCommand::class ,
28
+ RunCommand::class ,
29
+ MarkCommand::class,
30
30
]);
31
31
}
32
32
}
@@ -43,91 +43,74 @@ public function register()
43
43
);
44
44
45
45
$ this ->registerRepository ();
46
-
47
46
$ this ->registerRunner ();
48
-
49
47
$ this ->registerCreator ();
50
48
51
49
if ($ this ->app ->runningInConsole ()) {
52
- // Register commands
53
50
$ this ->registerMigrateInstallCommand ();
54
-
55
51
$ this ->registerMakeCommand ();
56
-
57
52
$ this ->registerRunCommand ();
58
-
59
53
$ this ->registerMarkCommand ();
60
54
}
61
55
}
62
56
63
57
/**
64
58
* Register the migration repository service.
65
- *
66
- * @return void
67
59
*/
68
- protected function registerRepository ()
60
+ protected function registerRepository (): void
69
61
{
70
- $ this ->app ->singleton (' deploy-commands.repository ' , function ($ app ) {
71
- $ table = $ app [ ' config ' ][ ' deploy-commands.table '] ;
62
+ $ this ->app ->singleton (DatabaseMigrationRepository::class , function ($ app ) {
63
+ $ table = config ( ' deploy-commands.table ') ;
72
64
73
65
return new DatabaseMigrationRepository ($ app ['db ' ], $ table );
74
66
});
75
67
}
76
68
77
69
/**
78
70
* Register the migrator service.
79
- *
80
- * @return void
81
71
*/
82
- protected function registerRunner ()
72
+ protected function registerRunner (): void
83
73
{
84
74
// The migrator is responsible for actually running and rollback the migration
85
75
// files in the application. We'll pass in our database connection resolver
86
76
// so the migrator can resolve any of these connections when it needs to.
87
- $ this ->app ->singleton (' deploy-commands.runner ' , function ($ app ) {
88
- $ repository = $ app[ ' deploy-commands.repository ' ] ;
77
+ $ this ->app ->singleton (CommandRunner::class , function ($ app ) {
78
+ $ repository = $ app-> make (DatabaseMigrationRepository::class) ;
89
79
90
80
return new CommandRunner ($ app , $ repository , $ app ['db ' ], $ app ['files ' ]);
91
81
});
92
82
}
93
83
94
84
/**
95
85
* Register the migration creator.
96
- *
97
- * @return void
98
86
*/
99
- protected function registerCreator ()
87
+ protected function registerCreator (): void
100
88
{
101
- $ this ->app ->singleton (' deploy-commands.creator ' , function ($ app ) {
89
+ $ this ->app ->singleton (CommandCreator::class , function ($ app ) {
102
90
return new CommandCreator ($ app ['files ' ]);
103
91
});
104
92
}
105
93
106
94
/**
107
95
* Register the command.
108
- *
109
- * @return void
110
96
*/
111
- protected function registerMigrateInstallCommand ()
97
+ protected function registerMigrateInstallCommand (): void
112
98
{
113
- $ this ->app ->singleton (' command.deploy-commands.install ' , function ($ app ) {
114
- return new InstallCommand ($ app[ ' deploy-commands.repository ' ] );
99
+ $ this ->app ->singleton (InstallCommand::class , function ($ app ) {
100
+ return new InstallCommand ($ app-> make (DatabaseMigrationRepository::class) );
115
101
});
116
102
}
117
103
118
104
/**
119
105
* Register the command.
120
- *
121
- * @return void
122
106
*/
123
- protected function registerMakeCommand ()
107
+ protected function registerMakeCommand (): void
124
108
{
125
- $ this ->app ->singleton (' command.deploy-commands.make ' , function ($ app ) {
109
+ $ this ->app ->singleton (MakeCommand::class , function ($ app ) {
126
110
// Once we have the migration creator registered, we will create the command
127
111
// and inject the creator. The creator is responsible for the actual file
128
112
// creation of the migrations, and may be extended by these developers.
129
- $ creator = $ app ['deploy-commands.creator ' ];
130
-
113
+ $ creator = $ app ->make (CommandCreator::class);
131
114
$ composer = $ app ['composer ' ];
132
115
133
116
return new MakeCommand ($ creator , $ composer );
@@ -136,40 +119,33 @@ protected function registerMakeCommand()
136
119
137
120
/**
138
121
* Register the command.
139
- *
140
- * @return void
141
122
*/
142
- protected function registerRunCommand ()
123
+ protected function registerRunCommand (): void
143
124
{
144
- $ this ->app ->singleton (' command.deploy-commands.run ' , function ($ app ) {
145
- return new RunCommand ($ app[ ' deploy-commands.runner ' ] );
125
+ $ this ->app ->singleton (RunCommand::class , function ($ app ) {
126
+ return new RunCommand ($ app-> make (CommandRunner::class) );
146
127
});
147
128
}
148
129
149
130
/**
150
131
* Register the command.
151
- *
152
- * @return void
153
132
*/
154
- protected function registerMarkCommand ()
133
+ protected function registerMarkCommand (): void
155
134
{
156
- $ this ->app ->singleton (' command.deploy-commands.mark ' , function ($ app ) {
157
- return new MarkCommand ($ app[ ' deploy-commands.runner ' ] );
135
+ $ this ->app ->singleton (MarkCommand::class , function ($ app ) {
136
+ return new MarkCommand ($ app-> make (CommandRunner::class) );
158
137
});
159
138
}
160
139
161
-
162
140
/**
163
141
* Get the services provided by the provider.
164
- *
165
- * @return array
166
142
*/
167
- public function provides ()
143
+ public function provides (): array
168
144
{
169
145
return [
170
- ' deploy-commands.repository ' ,
171
- ' deploy-commands.runner ' ,
172
- ' deploy-commands.creator ' ,
146
+ DatabaseMigrationRepository::class ,
147
+ CommandRunner::class ,
148
+ CommandCreator::class ,
173
149
];
174
150
}
175
151
}
0 commit comments