Inheritance: implements Nwidart\Modules\Contracts\RepositoryInterface, implements Countabl\Countable
Exemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $this->module = $this->laravel['modules'];
     $name = $this->argument('module');
     if ($name) {
         $module = $this->module->findOrFail($name);
         return $this->migrate($module);
     }
     foreach ($this->module->getOrdered($this->option('direction')) as $module) {
         $this->line('Running for module: <info>' . $module->getName() . '</info>');
         $this->migrate($module);
     }
 }
Exemplo n.º 2
0
 /**
  * Get destination path.
  *
  * @return string
  */
 public function getDestinationPath()
 {
     if ($this->path) {
         return $this->path;
     }
     return $this->repository->getModulePath($this->getModuleName());
 }
 /**
  * Rollback migration from the specified module.
  *
  * @param $module
  */
 public function reset($module)
 {
     if (is_string($module)) {
         $module = $this->module->findOrFail($module);
     }
     $migrator = new Migrator($module);
     $database = $this->option('database');
     if (!empty($database)) {
         $migrator->setDatabase($database);
     }
     $migrated = $migrator->reset();
     if (count($migrated)) {
         foreach ($migrated as $migration) {
             $this->line("Rollback: <info>{$migration}</info>");
         }
         return;
     }
     $this->comment('Nothing to rollback.');
 }
 /** @test */
 public function it_migrates_a_module()
 {
     $this->repository->addLocation(__DIR__ . '/../stubs/Recipe');
     $this->artisan('module:migrate', ['module' => 'Recipe']);
     dd(Schema::hasTable('recipe__recipes'), $this->app['db']->table('recipe__recipes')->get());
 }
Exemplo n.º 5
0
 /** @test */
 public function it_can_delete_a_module()
 {
     $this->artisan('module:make', ['name' => ['Blog']]);
     $this->repository->delete('Blog');
     $this->assertFalse(is_dir(base_path('modules/Blog')));
 }
Exemplo n.º 6
0
 /**
  * Get laravel filesystem instance.
  *
  * @return \Illuminate\Filesystem\Filesystem
  */
 public function getFilesystem()
 {
     return $this->repository->getFiles();
 }