Created
September 19, 2019 20:54
-
-
Save filipedanielski/9294baf32a74df82f1a44d5d41f75e9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace WF5\Muse\Core\Providers; | |
| use WF5\Muse\Core\Database\Migrator; | |
| use Illuminate\Support\ServiceProvider; | |
| use Illuminate\Contracts\Support\DeferrableProvider; | |
| class NamespacedMigrationServiceProvider extends ServiceProvider implements DeferrableProvider | |
| { | |
| /** | |
| * Register the service provider. | |
| * | |
| * @return void | |
| */ | |
| public function register() | |
| { | |
| $this->registerMigrator(); | |
| } | |
| /** | |
| * Register the migrator service. | |
| * | |
| * @return void | |
| */ | |
| protected function registerMigrator() | |
| { | |
| // The migrator is responsible for actually running and rollback the migration | |
| // files in the application. We'll pass in our database connection resolver | |
| // so the migrator can resolve any of these connections when it needs to. | |
| $this->app->extend('migrator', function ($service, $app) { | |
| $repository = $app['migration.repository']; | |
| return new Migrator($repository, $app['db'], $app['files'], $app['events']); | |
| }); | |
| } | |
| /** | |
| * Get the services provided by the provider. | |
| * | |
| * @return array | |
| */ | |
| public function provides() | |
| { | |
| return [ | |
| 'migrator' | |
| ]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment