Mercurial > packages > magicforger
diff 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 |
line wrap: on
line diff
--- a/src/Generator/Generator.php Thu Sep 11 21:25:51 2025 -0400 +++ b/src/Generator/Generator.php Sat Sep 20 17:14:29 2025 -0400 @@ -41,7 +41,7 @@ /* dd($this->getCurrentTable()->getForeignKeys()); */ if ($this->option('all')) { - /* $this->input->setOption('factory', true); */ + $this->input->setOption('factory', true); /* $this->input->setOption('seed', true); */ /* $this->input->setOption('migration', true); */ $this->input->setOption('controller', true); @@ -51,9 +51,9 @@ $this->input->setOption('route', true); } - /* if ($this->option('factory')) { */ - /* $this->createFactory(); */ - /* } */ + if ($this->option('factory')) { + $this->createFactory(); + } /* if ($this->option('migration')) { */ /* $this->createMigration(); */ @@ -96,6 +96,7 @@ ['request', 'r', InputOption::VALUE_NONE, 'Generate base request classes for the table.'], ['view', '', InputOption::VALUE_NONE, 'Generate base views for the table.'], ['route', 'w', InputOption::VALUE_NONE, 'Generate base routes classes for the table.'], + ['factory', 'f', InputOption::VALUE_NONE, 'Generate base factory classes for the table.'], ]); } @@ -130,4 +131,9 @@ { $this->call('mf:route', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); } + + protected function createFactory() + { + $this->call('mf:factory', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); + } }
