diff src/Generator/Requests/RequestGenerator.php @ 29:010ace248d14 codex

Added support for filters, not fully there with relations or anything like that but it's a start
author Luka Sitas <sitas.luka.97@gmail.com>
date Mon, 09 Jun 2025 20:51:04 -0400
parents 827efbf4d73c
children 21439512ba69
line wrap: on
line diff
--- a/src/Generator/Requests/RequestGenerator.php	Mon Jun 09 19:51:31 2025 -0400
+++ b/src/Generator/Requests/RequestGenerator.php	Mon Jun 09 20:51:04 2025 -0400
@@ -45,10 +45,15 @@
         }
 
         if ($this->option('all')) {
+            $this->input->setOption('filter_request', true);
             $this->input->setOption('store_request', true);
             $this->input->setOption('update_request', true);
         }
 
+        if ($this->option('filter_request')) {
+            $this->createFilterRequest();
+        }
+
         if ($this->option('store_request')) {
             $this->createStoreRequest();
         }
@@ -65,6 +70,7 @@
     {
         return array_merge(parent::getOptions(), [
             ['all', 'a', InputOption::VALUE_NONE, 'Generate all request classes for the table.'],
+            ['filter_request', 'f', InputOption::VALUE_NONE, 'Generate filter request class for the table.'],
             ['store_request', 's', InputOption::VALUE_NONE, 'Generate store request class for the table.'],
             ['update_request', 'u', InputOption::VALUE_NONE, 'Generate update request class for the table.'],
         ]);
@@ -82,6 +88,11 @@
      */
     protected function getStub() {}
 
+    protected function createFilterRequest()
+    {
+        $this->call('mf:filter_request', ['table' => $this->getTableInput()]);
+    }
+
     protected function createStoreRequest()
     {
         $this->call('mf:store_request', ['table' => $this->getTableInput()]);