diff 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
line wrap: on
line diff
--- a/src/Generator/Generator.php	Tue Apr 22 21:37:44 2025 -0400
+++ b/src/Generator/Generator.php	Sun May 11 21:03:51 2025 -0400
@@ -47,6 +47,7 @@
             $this->input->setOption('controller', true);
             $this->input->setOption('model', true);
             $this->input->setOption('request', true);
+            $this->input->setOption('view', true);
             $this->input->setOption('route', true);
         }
 
@@ -74,6 +75,10 @@
             $this->createRequest();
         }
 
+        if ($this->option('view')) {
+            $this->createView();
+        }
+
         if ($this->option('route')) {
             $this->createRoute();
         }
@@ -89,6 +94,7 @@
             ['controller', 'c', InputOption::VALUE_NONE, 'Generate a controller class for the table.'],
             ['model', 'm', InputOption::VALUE_NONE, 'Generate a model class for the table.'],
             ['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.'],
         ]);
     }
@@ -115,6 +121,11 @@
         $this->call('mf:request', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh'), '--all' => true]);
     }
 
+    protected function createView()
+    {
+        $this->call('mf:view', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh'), '--all' => true]);
+    }
+
     protected function createRoute()
     {
         $this->call('mf:route', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]);