diff src/Generator/Controller/stubs/controller.stub @ 27:b17f81b804ff codex

Added support for routes
author Luka Sitas <sitas.luka.97@gmail.com>
date Mon, 02 Jun 2025 21:51:09 -0400
parents 555bfaa500ac
children 010ace248d14
line wrap: on
line diff
--- a/src/Generator/Controller/stubs/controller.stub	Thu May 15 21:50:38 2025 -0400
+++ b/src/Generator/Controller/stubs/controller.stub	Mon Jun 02 21:51:09 2025 -0400
@@ -65,6 +65,17 @@
         return view('{{ tableName }}.show', $data);
     }
 
+		/**
+		 * Returns the resource in JSON format.
+		 *
+		 * @param ModelType $modelVariable
+		 * @return string
+		 */
+    public function load({{ model }} ${{ modelVariable }})
+    {
+        return ${{ modelVariable }}->toJson();
+    }
+
     /**
      * Show the form for editing the specified resource.
      *