diff src/Generator/Generator.php @ 45:c7fd31303024 default tip

merging down to default
author Luka Sitas <sitas.luka.97@gmail.com>
date Thu, 12 Nov 2026 21:19:53 -0500
parents c062f013fd19
children
line wrap: on
line diff
--- a/src/Generator/Generator.php	Wed Sep 10 21:00:47 2025 -0400
+++ b/src/Generator/Generator.php	Thu Nov 12 21:19:53 2026 -0500
@@ -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);
@@ -49,11 +49,12 @@
             $this->input->setOption('request', true);
             $this->input->setOption('view', true);
             $this->input->setOption('route', true);
+            $this->input->setOption('test', true);
         }
 
-        /* if ($this->option('factory')) { */
-        /*     $this->createFactory(); */
-        /* } */
+        if ($this->option('factory')) {
+            $this->createFactory();
+        }
 
         /* if ($this->option('migration')) { */
         /*     $this->createMigration(); */
@@ -82,6 +83,10 @@
         if ($this->option('route')) {
             $this->createRoute();
         }
+
+        if ($this->option('test')) {
+            $this->createTest();
+        }
     }
 
     /**
@@ -96,6 +101,8 @@
             ['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.'],
+            ['test', 't', InputOption::VALUE_NONE, 'Generate base test classes for the table.'],
         ]);
     }
 
@@ -130,4 +137,14 @@
     {
         $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')]);
+    }
+
+    protected function createTest()
+    {
+        $this->call('mf:test', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]);
+    }
 }