/** * Start make controller. * * @return void */ private function start() { $name = $this->scaffoldCommandObj->getObjName('Name') . 'Controller'; $path = $this->getPath($name, 'controller'); if ($this->files->exists($path)) { return $this->scaffoldCommandObj->comment("x {$name}"); } $this->makeDirectory($path); $this->files->put($path, $this->compileControllerStub()); $this->scaffoldCommandObj->info('+ Controller'); }
/** * Start make view. * * @return void */ private function start() { $this->scaffoldCommandObj->line("\n--- Views ---"); $viewsFiles = $this->getStubViews($this->scaffoldCommandObj->getMeta()['ui']); $destination = $this->getDestinationViews($this->scaffoldCommandObj->getMeta()['models']); $metas = $this->scaffoldCommandObj->getMeta(); $metas = array_merge_recursive($metas, ['form_fields_fillable' => $this->getFields($metas['ui'], 'fillable'), 'form_fields_empty' => $this->getFields($metas['ui'], 'empty'), 'form_fields_show' => $this->getFields($metas['ui'], 'show'), 'table_fields_header' => $this->getFields($metas['ui'], 'header'), 'table_fields_content' => $this->getFields($metas['ui'], 'content')]); foreach ($viewsFiles as $viewFileBaseName => $viewFile) { $viewFileName = str_replace('.stub', '', $viewFileBaseName); $viewDestination = $destination . $viewFileName; if ($this->files->exists($viewDestination)) { $this->scaffoldCommandObj->comment(" x {$viewFileName}"); continue; } $stub = $this->files->get($viewFile); $stub = $this->buildStub($metas, $stub); $this->makeDirectory($viewDestination); $this->files->put($viewDestination, $stub); $this->scaffoldCommandObj->info(" + {$viewFileName}"); } }