/** * Seed the specific module. * * @param string $module * * @return array */ protected function seed($slug) { $module = $this->module->where('slug', $slug)->first(); $params = []; $namespacePath = $this->module->getNamespace(); $rootSeeder = $module['namespace'] . 'DatabaseSeeder'; $fullPath = $namespacePath . '\\' . $module['namespace'] . '\\Database\\Seeds\\' . $rootSeeder; if (class_exists($fullPath)) { if ($this->option('class')) { $params['--class'] = $this->option('class'); } else { $params['--class'] = $fullPath; } if ($option = $this->option('database')) { $params['--database'] = $option; } if ($option = $this->option('force')) { $params['--force'] = $option; } $this->call('db:seed', $params); } }
/** * Seed the specific module. * * @param string $module * @return array */ protected function seed($module) { $params = array(); $moduleName = studly_case($module); $namespace = $this->module->getNamespace(); $rootSeeder = $moduleName . 'DatabaseSeeder'; $fullPath = $namespace . $moduleName . '\\Database\\Seeds\\' . $rootSeeder; if (class_exists($fullPath)) { if ($this->option('class')) { $params['--class'] = $this->option('class'); } else { $params['--class'] = $fullPath; } if ($option = $this->option('database')) { $params['--database'] = $option; } if ($option = $this->option('force')) { $params['--force'] = $option; } $this->call('db:seed', $params); } }
/** * Get the configured module base namespace. * * @return string */ protected function getBaseNamespace() { return $this->module->getNamespace(); }
/** * Replace placeholder text with correct values. * * @param string $content * @return string */ protected function formatContent($content) { return str_replace(['{{className}}', '{{moduleName}}', '{{namespace}}'], [$this->className, $this->moduleName, $this->module->getNamespace()], $content); }
/** * Replace placeholder text with correct values. * * @return string */ protected function formatContent($content) { return str_replace(['{{slug}}', '{{name}}', '{{namespace}}', '{{version}}', '{{description}}', '{{author}}', '{{path}}'], [$this->container['slug'], $this->container['name'], $this->container['namespace'], $this->container['version'], $this->container['description'], $this->container['author'], $this->module->getNamespace()], $content); }