/** * Execute the command. */ public function fire() { $generator = new ViewGenerator(['name' => $this->argument('name'), 'extends' => $this->option('extends'), 'section' => $this->option('section'), 'master' => $this->option('master'), 'plain' => $this->option('plain'), 'content' => $this->option('content'), 'template' => $this->option('template'), 'force' => $this->option('force')]); $generator->run(); $this->info("View {$generator->getName()} created successfully."); }
/** * Generate a scaffold view. * * @param Table $table * @param string $view * @throws FileAlreadyExistsException */ public function generateView(Table $table, $view) { $generator = new ViewGenerator(['name' => $this->getPrefix('/') . $this->getEntities($table) . '/' . $view, 'extends' => str_replace('/', '.', $this->getViewLayout()), 'template' => __DIR__ . '/../Stubs/scaffold/views/' . $view . '.stub', 'force' => $this->console->option('force')]); $tableDumper = $this->getTableDumper($table); $generator->appendReplacement(array_merge($this->getControllerScaffolder($table)->toArray(), ['lower_plural_entity' => strtolower($this->getEntities($table)), 'studly_singular_entity' => Str::studly($this->getEntity($table)), 'form' => $this->getFormGenerator($table)->render(), 'table_heading' => $tableDumper->toHeading(), 'table_body' => $tableDumper->toBody($this->getEntity($table)), 'show_body' => $tableDumper->toRows($this->getEntity($table))])); $generator->run(); $this->console->info("View {$generator->getName()} created successfully."); }