diff --git a/backend/app/Http/Controllers/Api/TemplateApiController.php b/backend/app/Http/Controllers/Api/TemplateApiController.php index 0a0f66a..37903bc 100644 --- a/backend/app/Http/Controllers/Api/TemplateApiController.php +++ b/backend/app/Http/Controllers/Api/TemplateApiController.php @@ -8,11 +8,23 @@ use App\Models\Template; class TemplateApiController extends Controller { // User hanya bisa lihat semua template - public function index() - { - // UBAH DI SINI: 'fitur' -> 'fiturs' - return response()->json(Template::with(['kategori','fiturs'])->get()); - } + public function index() +{ + $templates = Template::with(['kategori','fiturs']) + ->get() + ->map(function($t){ + return [ + 'id' => $t->id, + 'nama' => $t->nama_template, + 'harga' => (float) $t->harga, + 'foto' => asset('storage/' . $t->foto), + 'kategori' => $t->kategori, + 'fiturs' => $t->fiturs, + ]; + }); + + return response()->json($templates); +} // User bisa lihat detail 1 template public function show(Template $template) diff --git a/proyek-frontend/app/components/landing-page/featuredtemplates.vue b/proyek-frontend/app/components/landing-page/featuredtemplates.vue index 0bc9079..743ea73 100644 --- a/proyek-frontend/app/components/landing-page/featuredtemplates.vue +++ b/proyek-frontend/app/components/landing-page/featuredtemplates.vue @@ -1,175 +1,108 @@ + + - -