From 1ea3c0b0879f31c77aee4ecb4c8ab265f320a072 Mon Sep 17 00:00:00 2001 From: toni-santos Date: Tue, 26 Sep 2023 16:25:21 +0100 Subject: [PATCH 1/5] started working on shop frontend --- resources/js/Components/Shop/ShopItem.vue | 25 +++++++++++++ resources/js/Pages/Shop.vue | 44 +++++++++++++++++++++++ routes/web.php | 4 +++ 3 files changed, 73 insertions(+) create mode 100644 resources/js/Components/Shop/ShopItem.vue create mode 100644 resources/js/Pages/Shop.vue diff --git a/resources/js/Components/Shop/ShopItem.vue b/resources/js/Components/Shop/ShopItem.vue new file mode 100644 index 00000000..c4a4cf61 --- /dev/null +++ b/resources/js/Components/Shop/ShopItem.vue @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/resources/js/Pages/Shop.vue b/resources/js/Pages/Shop.vue new file mode 100644 index 00000000..8c81220b --- /dev/null +++ b/resources/js/Pages/Shop.vue @@ -0,0 +1,44 @@ + + + \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index f8a4fe73..c5dc6480 100644 --- a/routes/web.php +++ b/routes/web.php @@ -45,6 +45,10 @@ Route::get('/program', [ProgramController::class, 'show'])->name('program'); +Route::get('/shop', function() { + return Inertia::render('Shop'); +})->name('shop'); + Route::prefix('/competition')->name('competition')->group(function () { Route::get('/{competition:slug}', [CompetitionController::class, 'show'])->name('.show'); }); From 99dfaea9e1fb683b42b1977a7eae122738617ac6 Mon Sep 17 00:00:00 2001 From: toni-santos Date: Wed, 27 Sep 2023 00:38:05 +0100 Subject: [PATCH 2/5] fetch products from backend and fix layout --- app/Http/Controllers/ShopController.php | 26 +++++++++++++++++++ resources/js/Components/Shop/ShopItem.vue | 14 +++++----- resources/js/Pages/Shop.vue | 31 ++--------------------- routes/web.php | 5 ++-- 4 files changed, 36 insertions(+), 40 deletions(-) create mode 100644 app/Http/Controllers/ShopController.php diff --git a/app/Http/Controllers/ShopController.php b/app/Http/Controllers/ShopController.php new file mode 100644 index 00000000..ddb4bd72 --- /dev/null +++ b/app/Http/Controllers/ShopController.php @@ -0,0 +1,26 @@ +input('edition'); + + if ($edition === null) { + return response('No edition found', 500); + } + + $products = Product::where('edition_id', $edition->id)->get(); + + return Inertia::render('Shop', [ + 'products' => $products, + ]); + } +} diff --git a/resources/js/Components/Shop/ShopItem.vue b/resources/js/Components/Shop/ShopItem.vue index c4a4cf61..6ac32107 100644 --- a/resources/js/Components/Shop/ShopItem.vue +++ b/resources/js/Components/Shop/ShopItem.vue @@ -1,23 +1,21 @@