Inheritance: extends Illuminate\Support\ServiceProvider
Exemplo n.º 1
0
 /**
  * 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()]);
     }
 }
Exemplo n.º 2
0
 /**
  * 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, '\\');
 }
Exemplo n.º 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());
 }
Exemplo n.º 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.");
     }
 }
Exemplo n.º 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);
 }