comparison src/Generator/Generator.php @ 23:827efbf4d73c main-dev

Huge changes to the relationships for models and more complex
author Luka Sitas <sitas.luka.97@gmail.com>
date Fri, 11 Apr 2025 20:50:20 -0400
parents ee8ef14e158d
children 1a717c7b211f
comparison
equal deleted inserted replaced
22:ee8ef14e158d 23:827efbf4d73c
27 /** 27 /**
28 * Execute the console command. 28 * Execute the console command.
29 */ 29 */
30 public function handle() 30 public function handle()
31 { 31 {
32
32 // First we need to ensure that the table exists, then we can 33 // First we need to ensure that the table exists, then we can
33 if (!$this->tableExists($this->getTableInput())) { 34 if (! $this->tableExists($this->getTableInput())) {
34 $this->components->error('The table: "'.$this->getTableInput().'" does not exist in the database.'); 35 $this->components->error('The table: "'.$this->getTableInput().'" does not exist in the database.');
35 36
36 return false; 37 return false;
37 } 38 }
38 39
78 } 79 }
79 } 80 }
80 81
81 /** 82 /**
82 * Get the console command options. 83 * Get the console command options.
83 *
84 * @return array
85 */ 84 */
86 protected function getOptions(): array 85 protected function getOptions(): array
87 { 86 {
88 return array_merge(parent::getOptions(), [ 87 return array_merge(parent::getOptions(), [
89 ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, seeder, factory, policy, resource controller, and form request classes for the table.'], 88 ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, seeder, factory, policy, resource controller, and form request classes for the table.'],
94 ]); 93 ]);
95 } 94 }
96 95
97 /** 96 /**
98 * Interact further with the user if they were prompted for missing arguments. 97 * Interact further with the user if they were prompted for missing arguments.
99 *
100 * @return void
101 */ 98 */
102 protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output):void 99 protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output): void {}
103 {
104 }
105 100
106 protected function getStub():void 101 protected function getStub(): void {}
107 {
108 }
109 102
110 protected function createController(): void 103 protected function createController(): void
111 { 104 {
112 $this->call('mf:controller', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); 105 $this->call('mf:controller', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]);
113 } 106 }