Mercurial > packages > magicforger
comparison src/Generator/Generator.php @ 7:769a17898cc0
Various changes to the generators and replacers - probably mostly just formatting
| author | luka |
|---|---|
| date | Wed, 18 Oct 2023 21:04:11 -0400 |
| parents | b0b2e79ad8e6 |
| children | 7ee152c22478 |
comparison
equal
deleted
inserted
replaced
| 6:b46922d4a301 | 7:769a17898cc0 |
|---|---|
| 1 <?php | 1 <?php |
| 2 | 2 |
| 3 namespace Wizzard\MagicForger\Generator; | 3 namespace Wizzard\MagicForger\Generator; |
| 4 | |
| 5 use DB; | |
| 6 | 4 |
| 7 use Symfony\Component\Console\Attribute\AsCommand; | 5 use Symfony\Component\Console\Attribute\AsCommand; |
| 8 use Symfony\Component\Console\Input\InputInterface; | 6 use Symfony\Component\Console\Input\InputInterface; |
| 9 use Symfony\Component\Console\Input\InputOption; | 7 use Symfony\Component\Console\Input\InputOption; |
| 10 use Symfony\Component\Console\Output\OutputInterface; | 8 use Symfony\Component\Console\Output\OutputInterface; |
| 11 use Illuminate\Support\Str; | |
| 12 | |
| 13 use Wizzard\MagicForger\Generator\BaseGenerator; | |
| 14 | 9 |
| 15 #[AsCommand(name: 'mf')] | 10 #[AsCommand(name: 'mf')] |
| 16 class Generator extends BaseGenerator | 11 class Generator extends BaseGenerator |
| 17 { | 12 { |
| 18 /** | 13 /** |
| 27 * | 22 * |
| 28 * @var string | 23 * @var string |
| 29 */ | 24 */ |
| 30 protected $description = 'Generates any (or all) of the available files.'; | 25 protected $description = 'Generates any (or all) of the available files.'; |
| 31 | 26 |
| 32 | |
| 33 /** | 27 /** |
| 34 * Execute the console command. | 28 * Execute the console command. |
| 35 */ | 29 */ |
| 36 public function handle() | 30 public function handle() |
| 37 { | 31 { |
| 38 | |
| 39 // First we need to ensure that the table exists, then we can | 32 // First we need to ensure that the table exists, then we can |
| 40 if (!$this->tableExists($this->getTableInput())) { | 33 if (!$this->tableExists($this->getTableInput())) { |
| 41 $this->components->error('The table: "'.$this->getTableInput().'" does not exist in the database.'); | 34 $this->components->error('The table: "'.$this->getTableInput().'" does not exist in the database.'); |
| 42 | 35 |
| 43 return false; | 36 return false; |
| 44 } | 37 } |
| 45 | 38 |
| 46 $this->setCurrentTable($this->getTableInput()); | 39 /* $this->setCurrentTable($this->getTableInput()); */ |
| 47 dd($this->getCurrentTable()->getForeignKeys()); | 40 /* dd($this->getCurrentTable()->getForeignKeys()); */ |
| 48 | 41 |
| 49 if ($this->option('all')) { | 42 if ($this->option('all')) { |
| 50 /* $this->input->setOption('factory', true); */ | 43 /* $this->input->setOption('factory', true); */ |
| 51 /* $this->input->setOption('seed', true); */ | 44 /* $this->input->setOption('seed', true); */ |
| 52 /* $this->input->setOption('migration', true); */ | 45 /* $this->input->setOption('migration', true); */ |
| 81 } | 74 } |
| 82 | 75 |
| 83 if ($this->option('route')) { | 76 if ($this->option('route')) { |
| 84 $this->createRoute(); | 77 $this->createRoute(); |
| 85 } | 78 } |
| 86 | |
| 87 } | 79 } |
| 88 | 80 |
| 89 /** | 81 /** |
| 90 * Get the console command options. | 82 * Get the console command options. |
| 91 * | 83 * |
