Caffeinated\Modules\Console\Commands\ModuleSeedCommand::seed PHP Method

seed() protected method

Seed the specific module.
protected seed ( $slug ) : array
return array
    protected function seed($slug)
    {
        $module = $this->module->where('slug', $slug);
        $params = [];
        $namespacePath = $this->module->getNamespace();
        $rootSeeder = $module['name'] . 'DatabaseSeeder';
        $fullPath = $namespacePath . '\\' . $module['name'] . '\\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);
            event($slug . '.module.seeded', [$module, $this->option()]);
        }
    }