/** * Generate a new theme by given theme name. * * @param string $name */ protected function generate($name) { $themePath = config('themes.path') . '/' . $name; $this->laravel['files']->copyDirectory(__DIR__ . '/stubs/theme', $themePath); Stub::createFromPath(__DIR__ . '/stubs/json.stub', compact('name'))->saveTo($themePath, 'theme.json'); Stub::createFromPath(__DIR__ . '/stubs/theme.stub')->saveTo($themePath, 'theme.php'); $this->info('Theme created successfully.'); }
/** * Setup stub path. */ public function setupStubPath() { $this->app->booted(function ($app) { Stub::setBasePath(__DIR__ . '/Commands/stubs'); if ($app['modules']->config('stubs.enabled') === true) { Stub::setBasePath($app['modules']->config('stubs.path')); } }); }
/** * @throws InvalidMigrationNameException * * @return mixed */ protected function getTemplateContents() { $parser = new NameParser($this->argument('name')); if ($parser->isCreate()) { return Stub::create('/migration/create.stub', ['class' => $this->getClass(), 'table' => $parser->getTable(), 'fields' => $this->getSchemaParser()->render()]); } elseif ($parser->isAdd()) { return Stub::create('/migration/add.stub', ['class' => $this->getClass(), 'table' => $parser->getTable(), 'fields_up' => $this->getSchemaParser()->up(), 'fields_down' => $this->getSchemaParser()->down()]); } elseif ($parser->isDelete()) { return Stub::create('/migration/delete.stub', ['class' => $this->getClass(), 'table' => $parser->getTable(), 'fields_down' => $this->getSchemaParser()->up(), 'fields_up' => $this->getSchemaParser()->down()]); } elseif ($parser->isDrop()) { return Stub::create('/migration/drop.stub', ['class' => $this->getClass(), 'table' => $parser->getTable(), 'fields' => $this->getSchemaParser()->render()]); } throw new \InvalidArgumentException('Invalid migration name'); }