From b1ae0f0964ecbf0c08e75ae5d9babf3b6a61f3f3 Mon Sep 17 00:00:00 2001 From: Neerholt Date: Mon, 29 Jun 2020 08:22:07 +0200 Subject: [PATCH 1/4] Fix edit siden --- skolehjem/app/Http/Controllers/MenuPlanController.php | 4 ++-- skolehjem/resources/views/admin/menuplans/edit.blade.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/skolehjem/app/Http/Controllers/MenuPlanController.php b/skolehjem/app/Http/Controllers/MenuPlanController.php index 3df1610..89d2370 100644 --- a/skolehjem/app/Http/Controllers/MenuPlanController.php +++ b/skolehjem/app/Http/Controllers/MenuPlanController.php @@ -75,8 +75,8 @@ class MenuPlanController extends Controller */ public function edit($id) { - $editLink = MenuPlan::find($id); - return Response::detect("menuplans.edit", ["menuPlans" => $editLink]); + $menuplan = MenuPlan::find($id); + return Response::detect("menuplans.edit", ["menuplan" => $menuplan]); } /** diff --git a/skolehjem/resources/views/admin/menuplans/edit.blade.php b/skolehjem/resources/views/admin/menuplans/edit.blade.php index 7295eae..3a2b051 100644 --- a/skolehjem/resources/views/admin/menuplans/edit.blade.php +++ b/skolehjem/resources/views/admin/menuplans/edit.blade.php @@ -6,7 +6,7 @@ @endsection @section("path") - Rediger Menuplan / + $menuplan]) }}" class="text-white">Rediger Menuplan / @endsection @section("content") From b46f8f7b0a131a092922d9f88b5f199cac602266 Mon Sep 17 00:00:00 2001 From: Vedde Date: Mon, 29 Jun 2020 08:30:31 +0200 Subject: [PATCH 2/4] changed route name and table data to show correct info --- skolehjem/resources/views/admin/external-links/edit.blade.php | 2 +- .../resources/views/admin/external-links/index.blade.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/skolehjem/resources/views/admin/external-links/edit.blade.php b/skolehjem/resources/views/admin/external-links/edit.blade.php index ae2f856..b789270 100644 --- a/skolehjem/resources/views/admin/external-links/edit.blade.php +++ b/skolehjem/resources/views/admin/external-links/edit.blade.php @@ -11,7 +11,7 @@ @section("content")

Rediger Link:

-
$link->name]) }}"> + $link]) }}"> @csrf diff --git a/skolehjem/resources/views/admin/external-links/index.blade.php b/skolehjem/resources/views/admin/external-links/index.blade.php index 1e692f3..5cff797 100644 --- a/skolehjem/resources/views/admin/external-links/index.blade.php +++ b/skolehjem/resources/views/admin/external-links/index.blade.php @@ -19,8 +19,8 @@ @foreach($links as $link) - {Titel} - {Link} + {{$link->name}} + {{$link->link}} Update Delete From a7c3a5477861439103fe9fe376accd80d4e78cf6 Mon Sep 17 00:00:00 2001 From: Neerholt Date: Mon, 29 Jun 2020 08:31:26 +0200 Subject: [PATCH 3/4] =?UTF-8?q?Data=20bliver=20nu=20vist=20p=C3=A5=20edit?= =?UTF-8?q?=20siden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/admin/menuplans/edit.blade.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/skolehjem/resources/views/admin/menuplans/edit.blade.php b/skolehjem/resources/views/admin/menuplans/edit.blade.php index 3a2b051..b65e800 100644 --- a/skolehjem/resources/views/admin/menuplans/edit.blade.php +++ b/skolehjem/resources/views/admin/menuplans/edit.blade.php @@ -11,22 +11,22 @@ @section("content")

Rediger Menuplan:

- + - + - + - + - + - + - + - + - + @endsection From 66ddd329446b6e8062f6e8b4bf5c2f27d0b549b5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 29 Jun 2020 08:31:36 +0200 Subject: [PATCH 4/4] Working on MenuPlanController.php --- .../Http/Controllers/MenuPlanController.php | 22 +++++++++---------- .../views/admin/menuplans/edit.blade.php | 20 +++++++++-------- .../views/admin/menuplans/index.blade.php | 2 +- .../views/admin/menuplans/update.blade.php | 4 ++-- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/skolehjem/app/Http/Controllers/MenuPlanController.php b/skolehjem/app/Http/Controllers/MenuPlanController.php index 4a5e0a9..9a7944a 100644 --- a/skolehjem/app/Http/Controllers/MenuPlanController.php +++ b/skolehjem/app/Http/Controllers/MenuPlanController.php @@ -75,8 +75,8 @@ class MenuPlanController extends Controller */ public function edit($id) { - $editLink = MenuPlan::find($id); - return Response::detect("menuplans.edit", ["menu-plans" => $editLink]); + $menuplan = MenuPlan::find($id); + return Response::detect("menuplans.edit", ["menuplan" => $menuplan]); } /** @@ -88,15 +88,14 @@ class MenuPlanController extends Controller */ public function update(Request $request, $id) { - $data = $request->validate([ - "name" => "", - "link" => "" - ]); + $data = $request->all(); - $id->update($data); - $id->save(); - return Response::detect("menuplans.update"); + $menuplan = MenuPlan::find($id); + $menuplan->update($data); + $menuplan->save(); + + return Response::detect("menuplans.update", [ "menuplan" => $menuplan ]); } /** @@ -107,7 +106,8 @@ class MenuPlanController extends Controller */ public function destroy($id) { - $id->delete(); - return Response::detect("menuplans.destroy"); + $menuplan = MenuPlan::find($id); + $menuplan->delete(); + return redirect()->route("menu-plans.index"); } } diff --git a/skolehjem/resources/views/admin/menuplans/edit.blade.php b/skolehjem/resources/views/admin/menuplans/edit.blade.php index 7295eae..45a90a3 100644 --- a/skolehjem/resources/views/admin/menuplans/edit.blade.php +++ b/skolehjem/resources/views/admin/menuplans/edit.blade.php @@ -6,26 +6,28 @@ @endsection @section("path") - Rediger Menuplan / + $menuplan ]) }}" class="text-white">Rediger Menuplan / @endsection @section("content")

Rediger Menuplan:

-
+ $menuplan ]) }}"> + @csrf + @method("PUT") - + - + - + - + - + - + - +
diff --git a/skolehjem/resources/views/admin/menuplans/index.blade.php b/skolehjem/resources/views/admin/menuplans/index.blade.php index 52c5e54..5c006ff 100644 --- a/skolehjem/resources/views/admin/menuplans/index.blade.php +++ b/skolehjem/resources/views/admin/menuplans/index.blade.php @@ -32,7 +32,7 @@ {{$menuplan->saturday}} {{$menuplan->sunday}} Update - Delete + $menuplan ]) }}">Delete @endforeach diff --git a/skolehjem/resources/views/admin/menuplans/update.blade.php b/skolehjem/resources/views/admin/menuplans/update.blade.php index ae46029..8c5ecc9 100644 --- a/skolehjem/resources/views/admin/menuplans/update.blade.php +++ b/skolehjem/resources/views/admin/menuplans/update.blade.php @@ -6,9 +6,9 @@ @endsection @section("path") - Rediger Menuplan / + $menuplan ]) }}" class="text-white">Rediger Menuplan / @endsection @section("content") - Din menuplan blev (ikke) redigeret. + Din menuplan blev redigeret. @endsection