comparison src/Generator/Generator.php @ 25:1a717c7b211f codex

added support for some basic views
author Luka Sitas <sitas.luka.97@gmail.com>
date Sun, 11 May 2025 21:03:51 -0400
parents 827efbf4d73c
children 76584181267a
comparison
equal deleted inserted replaced
24:31109c61ce02 25:1a717c7b211f
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('route', true); 51 $this->input->setOption('route', true);
51 } 52 }
52 53
53 /* if ($this->option('factory')) { */ 54 /* if ($this->option('factory')) { */
54 /* $this->createFactory(); */ 55 /* $this->createFactory(); */
72 73
73 if ($this->option('request')) { 74 if ($this->option('request')) {
74 $this->createRequest(); 75 $this->createRequest();
75 } 76 }
76 77
78 if ($this->option('view')) {
79 $this->createView();
80 }
81
77 if ($this->option('route')) { 82 if ($this->option('route')) {
78 $this->createRoute(); 83 $this->createRoute();
79 } 84 }
80 } 85 }
81 86
87 return array_merge(parent::getOptions(), [ 92 return array_merge(parent::getOptions(), [
88 ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, seeder, factory, policy, resource controller, and form request classes for the table.'], 93 ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, seeder, factory, policy, resource controller, and form request classes for the table.'],
89 ['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.'],
90 ['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.'],
91 ['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.'],
92 ['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.'],
93 ]); 99 ]);
94 } 100 }
95 101
96 /** 102 /**
113 protected function createRequest() 119 protected function createRequest()
114 { 120 {
115 $this->call('mf:request', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh'), '--all' => true]); 121 $this->call('mf:request', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh'), '--all' => true]);
116 } 122 }
117 123
124 protected function createView()
125 {
126 $this->call('mf:view', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh'), '--all' => true]);
127 }
128
118 protected function createRoute() 129 protected function createRoute()
119 { 130 {
120 $this->call('mf:route', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); 131 $this->call('mf:route', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]);
121 } 132 }
122 } 133 }