public function register()
 {
     parent::register();
     $this->registerMigrateOrganise();
     $this->registerMigrateDisorganise();
     $this->commands('command.migrate.organise', 'command.migrate.disorganise');
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     parent::register();
     $this->mergeConfigFrom($this->configPath, $this->name);
     $this->app[$this->name . '.make.migration'] = $this->app->share(function ($app) {
         return $app->make(MakeMigrationCommand::class);
     });
     $this->commands([$this->name . '.make.migration']);
 }
Esempio n. 3
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('migration.handler', function ($app) {
         return new MigrationHandler($app, collect());
     });
     $this->app->singleton('seed.handler', function ($app) {
         return new SeedHandler($app, collect());
     });
     parent::register();
 }
Esempio n. 4
0
 /**
  * @return \tomzx\LaravelMigration\BaseApplication
  */
 private function initialize()
 {
     if (interface_exists('Illuminate\\Contracts\\Foundation\\Application')) {
         $container = new \tomzx\LaravelMigration\v5\Application();
         $this->laravelVersion = 5;
         $container['path.database'] = getcwd();
     } else {
         $container = new \tomzx\LaravelMigration\v4\Application();
         $this->laravelVersion = 4;
         $container['path'] = getcwd();
         $container['path.base'] = getcwd();
         $container['path.database'] = getcwd() . '/database';
     }
     $container->singleton('events', function () {
         return new Dispatcher();
     });
     $container->singleton('files', function () {
         return new Filesystem();
     });
     $container->singleton('config', function () use($container) {
         if ($this->laravelVersion === 5) {
             $config = (require_once 'database.php');
             return new Repository(['database' => $config]);
         } else {
             $fileLoader = new FileLoader($container['files'], getcwd());
             return new Repository($fileLoader, 'production');
         }
     });
     $container->singleton('composer', function () {
         $composer = m::mock('\\Illuminate\\Foundation\\Composer');
         $composer->shouldReceive('dumpAutoloads');
         return $composer;
     });
     if ($this->laravelVersion === 4) {
         $container->singleton('command.dump-autoload', function () {
             $command = m::mock('\\Illuminate\\Console\\Command');
             $command->shouldReceive('setLaravel')->shouldReceive('setApplication')->shouldReceive('isEnabled')->andReturn(true)->shouldReceive('getDefinition')->andReturn([])->shouldReceive('getName')->andReturn('dump-autoload')->shouldReceive('getAliases')->andReturn([])->shouldReceive('run');
             return $command;
         });
         $events = $container['events'];
         $events->listen('artisan.start', function ($artisan) {
             $artisan->resolveCommands(['command.dump-autoload']);
         });
     }
     $databaseServiceProvider = new DatabaseServiceProvider($container);
     $databaseServiceProvider->register();
     $migrationServiceProvider = new MigrationServiceProvider($container);
     $migrationServiceProvider->register();
     return $container;
 }