Skip to content

Commit 032608e

Browse files
committed
bind Migrator
1 parent 15d884a commit 032608e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Illuminate/Database/MigrationServiceProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Illuminate\Database\Migrations\MigrationCreator;
1717
use Illuminate\Database\Migrations\Migrator;
1818
use Illuminate\Support\ServiceProvider;
19+
use Illuminate\Tests\Integration\Database\DatabaseTestCase;
1920

2021
class MigrationServiceProvider extends ServiceProvider implements DeferrableProvider
2122
{
@@ -77,12 +78,12 @@ protected function registerMigrator()
7778
// The migrator is responsible for actually running and rollback the migration
7879
// files in the application. We'll pass in our database connection resolver
7980
// so the migrator can resolve any of these connections when it needs to.
80-
$this->app->singleton(Migrator::class, function ($app) {
81+
$this->app->singleton('migrator', function ($app) {
8182
$repository = $app['migration.repository'];
8283

8384
return new Migrator($repository, $app['db'], $app['files'], $app['events']);
8485
});
85-
$this->app->alias(Migrator::class, 'migrator');
86+
$this->app->bind(Migrator::class, fn ($app) => $app['migrator']);
8687
}
8788

8889
/**

tests/Integration/Migration/MigratorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function testMigrate()
5959
public function testMigrateWithoutOutput()
6060
{
6161
$this->app->forgetInstance('migrator');
62+
$this->app->forgetInstance(Migrator::class);
6263
$this->subject = $this->app->make('migrator');
6364

6465
$this->subject->run([__DIR__.'/fixtures']);

0 commit comments

Comments
 (0)