Ejemplo n.º 1
0
 /**
  * Start make migration.
  *
  * @return void
  */
 protected function start()
 {
     $name = 'create_' . str_plural(strtolower($this->scaffoldCommandObj->argument('name'))) . '_table';
     if ($this->files->exists($path = $this->getPath($name))) {
         return $this->scaffoldCommandObj->error($this->type . ' already exists!');
     }
     $this->makeDirectory($path);
     $this->files->put($path, $this->compileMigrationStub());
     $this->scaffoldCommandObj->info('+ Migration');
 }
Ejemplo n.º 2
0
 /**
  * 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');
 }
Ejemplo n.º 3
0
 /**
  * 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}");
     }
 }