diff --git a/backend/app/Http/Controllers/Api/UlangTahunApiController.php b/backend/app/Http/Controllers/Api/UlangTahunApiController.php index 083e9ce..4511cba 100644 --- a/backend/app/Http/Controllers/Api/UlangTahunApiController.php +++ b/backend/app/Http/Controllers/Api/UlangTahunApiController.php @@ -32,9 +32,21 @@ class UlangTahunApiController extends Controller 'alamat_acara' => 'required|string', 'maps_acara' => 'nullable|string', 'link_musik' => 'nullable|string', - 'galeri' => 'nullable|string', + // --- PERBAIKAN VALIDASI GALERI --- + 'galeri' => 'nullable|array|max:5', + 'galeri.*' => 'image|mimes:jpeg,png,jpg,gif|max:2048', ]); +// --- PROSES UPLOAD GAMBAR --- + $galleryPaths = []; + if ($request->hasFile('galeri')) { + foreach ($request->file('galeri') as $file) { + $path = $file->store('gallery', 'public'); + $galleryPaths[] = $path; + } + } + $data['galeri'] = $galleryPaths; + // ✅ Ambil template berdasarkan template_id $template = Template::with('kategori')->findOrFail($data['template_id']); diff --git a/backend/app/Http/Controllers/TemplateController.php b/backend/app/Http/Controllers/TemplateController.php index 5f538cd..39d8069 100644 --- a/backend/app/Http/Controllers/TemplateController.php +++ b/backend/app/Http/Controllers/TemplateController.php @@ -21,6 +21,12 @@ class TemplateController extends Controller return view('admin.templates.index', compact('templates', 'kategoris', 'fiturs')); } +public function show($id) +{ + return Template::with('kategori')->findOrFail($id); +} + + public function store(Request $request) { $data = $request->validate([ diff --git a/proyek-frontend/app/components/forms/UlangTahunForm.vue b/proyek-frontend/app/components/forms/UlangTahunForm.vue new file mode 100644 index 0000000..f9cc62c --- /dev/null +++ b/proyek-frontend/app/components/forms/UlangTahunForm.vue @@ -0,0 +1,206 @@ + + + + \ No newline at end of file diff --git a/proyek-frontend/app/components/template-page/TemplateGrid.vue b/proyek-frontend/app/components/template-page/TemplateGrid.vue index f2c8303..6b71ac4 100644 --- a/proyek-frontend/app/components/template-page/TemplateGrid.vue +++ b/proyek-frontend/app/components/template-page/TemplateGrid.vue @@ -52,11 +52,11 @@ - Order - + :to="`/form/${tpl.kategori.nama.toLowerCase().replace(/ /g, '-')}` + `?template_id=${tpl.id}`" + class="w-full bg-blue-600 text-white font-semibold py-2 px-4 rounded-lg hover:bg-blue-700 transition-colors text-center" +> + Order + diff --git a/proyek-frontend/app/pages/form/ulang-tahun.vue b/proyek-frontend/app/pages/form/ulang-tahun.vue new file mode 100644 index 0000000..e2b3272 --- /dev/null +++ b/proyek-frontend/app/pages/form/ulang-tahun.vue @@ -0,0 +1,9 @@ + + + \ No newline at end of file