Mercurial > packages > magicforger
comparison src/Generator/Generator.php @ 36:76584181267a ls_dev_2025_09
Got factories working in a basic way, not sure how complex tables will handle it though
| author | Luka Sitas <sitas.luka.97@gmail.com> |
|---|---|
| date | Sat, 20 Sep 2025 17:14:29 -0400 |
| parents | 1a717c7b211f |
| children | 116b36f5e73b |
comparison
equal
deleted
inserted
replaced
| 35:55d2e5c5dad9 | 36:76584181267a |
|---|---|
| 39 | 39 |
| 40 /* $this->setCurrentTable($this->getTableInput()); */ | 40 /* $this->setCurrentTable($this->getTableInput()); */ |
| 41 /* dd($this->getCurrentTable()->getForeignKeys()); */ | 41 /* dd($this->getCurrentTable()->getForeignKeys()); */ |
| 42 | 42 |
| 43 if ($this->option('all')) { | 43 if ($this->option('all')) { |
| 44 /* $this->input->setOption('factory', true); */ | 44 $this->input->setOption('factory', true); |
| 45 /* $this->input->setOption('seed', true); */ | 45 /* $this->input->setOption('seed', true); */ |
| 46 /* $this->input->setOption('migration', true); */ | 46 /* $this->input->setOption('migration', true); */ |
| 47 $this->input->setOption('controller', true); | 47 $this->input->setOption('controller', true); |
| 48 $this->input->setOption('model', true); | 48 $this->input->setOption('model', true); |
| 49 $this->input->setOption('request', true); | 49 $this->input->setOption('request', true); |
| 50 $this->input->setOption('view', true); | 50 $this->input->setOption('view', true); |
| 51 $this->input->setOption('route', true); | 51 $this->input->setOption('route', true); |
| 52 } | 52 } |
| 53 | 53 |
| 54 /* if ($this->option('factory')) { */ | 54 if ($this->option('factory')) { |
| 55 /* $this->createFactory(); */ | 55 $this->createFactory(); |
| 56 /* } */ | 56 } |
| 57 | 57 |
| 58 /* if ($this->option('migration')) { */ | 58 /* if ($this->option('migration')) { */ |
| 59 /* $this->createMigration(); */ | 59 /* $this->createMigration(); */ |
| 60 /* } */ | 60 /* } */ |
| 61 | 61 |
| 94 ['controller', 'c', InputOption::VALUE_NONE, 'Generate a controller class for the table.'], | 94 ['controller', 'c', InputOption::VALUE_NONE, 'Generate a controller class for the table.'], |
| 95 ['model', 'm', InputOption::VALUE_NONE, 'Generate a model class for the table.'], | 95 ['model', 'm', InputOption::VALUE_NONE, 'Generate a model class for the table.'], |
| 96 ['request', 'r', InputOption::VALUE_NONE, 'Generate base request classes for the table.'], | 96 ['request', 'r', InputOption::VALUE_NONE, 'Generate base request classes for the table.'], |
| 97 ['view', '', InputOption::VALUE_NONE, 'Generate base views for the table.'], | 97 ['view', '', InputOption::VALUE_NONE, 'Generate base views for the table.'], |
| 98 ['route', 'w', InputOption::VALUE_NONE, 'Generate base routes classes for the table.'], | 98 ['route', 'w', InputOption::VALUE_NONE, 'Generate base routes classes for the table.'], |
| 99 ['factory', 'f', InputOption::VALUE_NONE, 'Generate base factory classes for the table.'], | |
| 99 ]); | 100 ]); |
| 100 } | 101 } |
| 101 | 102 |
| 102 /** | 103 /** |
| 103 * Interact further with the user if they were prompted for missing arguments. | 104 * Interact further with the user if they were prompted for missing arguments. |
| 128 | 129 |
| 129 protected function createRoute() | 130 protected function createRoute() |
| 130 { | 131 { |
| 131 $this->call('mf:route', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); | 132 $this->call('mf:route', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); |
| 132 } | 133 } |
| 134 | |
| 135 protected function createFactory() | |
| 136 { | |
| 137 $this->call('mf:factory', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); | |
| 138 } | |
| 133 } | 139 } |
