Inheritance: extends Illuminate\Support\ServiceProvider
 /**
  * Run the migration from the specified module.
  *
  * @param Module $module
  *
  * @return mixed
  */
 protected function migrate(Module $module)
 {
     $path = str_replace(base_path(), '', (new Migrator($module))->getPath());
     $this->call('migrate', ['--path' => $path, '--database' => $this->option('database'), '--pretend' => $this->option('pretend'), '--force' => $this->option('force')]);
     if ($this->option('seed')) {
         $this->call('module:seed', ['module' => $module->getName()]);
     }
 }
 /**
  * Get class namespace.
  *
  * @param \Nwidart\Modules\Module $module
  *
  * @return string
  */
 public function getClassNamespace($module)
 {
     $extra = str_replace($this->getClass(), '', $this->argument($this->argumentName));
     $extra = str_replace('/', '\\', $extra);
     $namespace = $this->laravel['modules']->config('namespace');
     $namespace .= '\\' . $module->getStudlyName();
     $namespace .= '\\' . $this->getDefaultNamespace();
     $namespace .= '\\' . $extra;
     return trim($namespace, '\\');
 }
示例#3
0
 /** @test */
 public function it_checks_module_enabled_status()
 {
     $this->assertTrue($this->module->enabled());
     $this->assertTrue($this->module->active());
     $this->assertFalse($this->module->notActive());
     $this->assertFalse($this->module->disabled());
 }
示例#4
0
 /**
  * @param Module $module
  *
  * @return void
  */
 public function moduleSeed(Module $module)
 {
     $seeders = [];
     $name = $module->getName();
     $config = $module->get('migration');
     if (is_array($config) && array_key_exists('seeds', $config)) {
         foreach ((array) $config['seeds'] as $class) {
             if (@class_exists($class)) {
                 $seeders[] = $class;
             }
         }
     } else {
         $class = $this->getSeederName($name);
         //legacy support
         if (@class_exists($class)) {
             $seeders[] = $class;
         }
     }
     if (count($seeders) > 0) {
         array_walk($seeders, [$this, 'dbSeed']);
         $this->info("Module [{$name}] seeded.");
     }
 }
示例#5
0
 /**
  * Get migration path.
  *
  * @return string
  */
 public function getPath()
 {
     $config = $this->module->get('migration');
     $path = is_array($config) && array_key_exists('path', $config) ? $config['path'] : config('modules.paths.generator.migration');
     return $this->module->getExtraPath($path);
 }