Beautiful Open-Source Form Builder
fix: return single template object instead of array in show() endpoint
Cursor Agent3fb6a429e3c6
diff --git a/api/app/Http/Controllers/Forms/TemplateController.php b/api/app/Http/Controllers/Forms/TemplateController.phpindex 804064dd3..416b9f7cb 100644--- a/api/app/Http/Controllers/Forms/TemplateController.php+++ b/api/app/Http/Controllers/Forms/TemplateController.php@@ -111,6 +111,13 @@ class TemplateController extends Controllerpublic function show(string $slug){$template = Template::whereSlug($slug)->first();- return ($template) ? new FormTemplateResource($template) : $this->getProdTemplates($slug);+ if ($template) {+ return new FormTemplateResource($template);+ }++ // Get prod template by slug and return first match (or null if not found)+ $prodTemplates = $this->getProdTemplates($slug);+ // Use array_values to reindex since filter() preserves original keys+ return !empty($prodTemplates) ? array_values($prodTemplates)[0] : null;}}