Skip to content

Commit 07cda8c

Browse files
authored
Merge pull request #2 from lutomski/feature/support-laravel-6x
Add support for laravel 6.x
2 parents 528dcd1 + a763aed commit 07cda8c

File tree

2 files changed

+31
-55
lines changed

2 files changed

+31
-55
lines changed

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.5",
20-
"illuminate/config": "5.0.*|5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*",
21-
"illuminate/filesystem": "5.0.*|5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*"
19+
"php": ">=7.2",
20+
"illuminate/config": "^6.0",
21+
"illuminate/filesystem": "^6.0"
2222
},
2323
"autoload": {
2424
"psr-4": {

src/ServiceProvider.php

+28-52
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public function boot()
2323

2424
if ($this->app->runningInConsole()) {
2525
$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,
3030
]);
3131
}
3232
}
@@ -43,91 +43,74 @@ public function register()
4343
);
4444

4545
$this->registerRepository();
46-
4746
$this->registerRunner();
48-
4947
$this->registerCreator();
5048

5149
if ($this->app->runningInConsole()) {
52-
// Register commands
5350
$this->registerMigrateInstallCommand();
54-
5551
$this->registerMakeCommand();
56-
5752
$this->registerRunCommand();
58-
5953
$this->registerMarkCommand();
6054
}
6155
}
6256

6357
/**
6458
* Register the migration repository service.
65-
*
66-
* @return void
6759
*/
68-
protected function registerRepository()
60+
protected function registerRepository(): void
6961
{
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');
7264

7365
return new DatabaseMigrationRepository($app['db'], $table);
7466
});
7567
}
7668

7769
/**
7870
* Register the migrator service.
79-
*
80-
* @return void
8171
*/
82-
protected function registerRunner()
72+
protected function registerRunner(): void
8373
{
8474
// The migrator is responsible for actually running and rollback the migration
8575
// files in the application. We'll pass in our database connection resolver
8676
// 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);
8979

9080
return new CommandRunner($app, $repository, $app['db'], $app['files']);
9181
});
9282
}
9383

9484
/**
9585
* Register the migration creator.
96-
*
97-
* @return void
9886
*/
99-
protected function registerCreator()
87+
protected function registerCreator(): void
10088
{
101-
$this->app->singleton('deploy-commands.creator', function ($app) {
89+
$this->app->singleton(CommandCreator::class, function ($app) {
10290
return new CommandCreator($app['files']);
10391
});
10492
}
10593

10694
/**
10795
* Register the command.
108-
*
109-
* @return void
11096
*/
111-
protected function registerMigrateInstallCommand()
97+
protected function registerMigrateInstallCommand(): void
11298
{
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));
115101
});
116102
}
117103

118104
/**
119105
* Register the command.
120-
*
121-
* @return void
122106
*/
123-
protected function registerMakeCommand()
107+
protected function registerMakeCommand(): void
124108
{
125-
$this->app->singleton('command.deploy-commands.make', function ($app) {
109+
$this->app->singleton(MakeCommand::class, function ($app) {
126110
// Once we have the migration creator registered, we will create the command
127111
// and inject the creator. The creator is responsible for the actual file
128112
// creation of the migrations, and may be extended by these developers.
129-
$creator = $app['deploy-commands.creator'];
130-
113+
$creator = $app->make(CommandCreator::class);
131114
$composer = $app['composer'];
132115

133116
return new MakeCommand($creator, $composer);
@@ -136,40 +119,33 @@ protected function registerMakeCommand()
136119

137120
/**
138121
* Register the command.
139-
*
140-
* @return void
141122
*/
142-
protected function registerRunCommand()
123+
protected function registerRunCommand(): void
143124
{
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));
146127
});
147128
}
148129

149130
/**
150131
* Register the command.
151-
*
152-
* @return void
153132
*/
154-
protected function registerMarkCommand()
133+
protected function registerMarkCommand(): void
155134
{
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));
158137
});
159138
}
160139

161-
162140
/**
163141
* Get the services provided by the provider.
164-
*
165-
* @return array
166142
*/
167-
public function provides()
143+
public function provides(): array
168144
{
169145
return [
170-
'deploy-commands.repository',
171-
'deploy-commands.runner',
172-
'deploy-commands.creator',
146+
DatabaseMigrationRepository::class,
147+
CommandRunner::class,
148+
CommandCreator::class,
173149
];
174150
}
175151
}

0 commit comments

Comments
 (0)