diff --git a/skolehjem/app/Http/Controllers/ExternalLinkController.php b/skolehjem/app/Http/Controllers/ExternalLinkController.php index 56ee195..2a6eafa 100644 --- a/skolehjem/app/Http/Controllers/ExternalLinkController.php +++ b/skolehjem/app/Http/Controllers/ExternalLinkController.php @@ -83,15 +83,13 @@ class ExternalLinkController extends Controller */ public function update(Request $request, $id) { - $data = $request->validate([ - "name" => "max:255", - "link" => "max:255" - ]); + $data = $request->all(); - $id->update($data); - $id->save(); + $link = ExternalLink::find($id); + $link->update($data); + $link->save(); - return Response::detect("external-links.update"); + return Response::detect("external-links.update", [ "link" => $link]); } /** @@ -102,7 +100,8 @@ class ExternalLinkController extends Controller */ public function destroy($id) { - $id->delete(); - return Response::detect("external-links.destroy"); + $link = ExternalLink::find($id); + $link->delete(); + return redirect()->route("external-links.index"); } } diff --git a/skolehjem/resources/views/admin/external-links/edit.blade.php b/skolehjem/resources/views/admin/external-links/edit.blade.php index b789270..027e71e 100644 --- a/skolehjem/resources/views/admin/external-links/edit.blade.php +++ b/skolehjem/resources/views/admin/external-links/edit.blade.php @@ -6,17 +6,18 @@ @endsection @section("path") - Rediger Link / + Rediger Link / @endsection @section("content")