From aac73f100fa71446b90dfd11e4562ef4da705472 Mon Sep 17 00:00:00 2001 From: sheby460 <59543240+sheby460@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:05:46 +0300 Subject: [PATCH] chuma logics --- .../LanguageKnowledgeController.php | 8 +- .../UserFamilyDetailsController.php | 14 +- resources/views/family-details/edit.blade.php | 187 ++---------------- .../views/family-details/index.blade.php | 2 +- resources/views/language/index.blade.php | 6 +- routes/web.php | 4 + 6 files changed, 42 insertions(+), 179 deletions(-) diff --git a/app/Http/Controllers/LanguageKnowledgeController.php b/app/Http/Controllers/LanguageKnowledgeController.php index 382eaac..ea4d7da 100644 --- a/app/Http/Controllers/LanguageKnowledgeController.php +++ b/app/Http/Controllers/LanguageKnowledgeController.php @@ -139,15 +139,15 @@ public function destroy($id) if ($languageKnowledge->userId != Auth::id()) { return redirect()->route('language_knowledge.index')->with('error', 'Unauthorized access.'); } - + $languageKnowledge->delete(); // Soft delete by setting delete_status to 1 - $languageKnowledge->delete_status = 1; - $languageKnowledge->save(); + // $languageKnowledge->delete_status = 1; + // $languageKnowledge->save(); return redirect()->route('language_knowledge.index')->with('success', 'Language knowledge deleted successfully.'); } public function jaribu(){ - + } } diff --git a/app/Http/Controllers/UserFamilyDetailsController.php b/app/Http/Controllers/UserFamilyDetailsController.php index cf978d3..d7fb79f 100644 --- a/app/Http/Controllers/UserFamilyDetailsController.php +++ b/app/Http/Controllers/UserFamilyDetailsController.php @@ -49,13 +49,15 @@ public function addFamilyData(Request $request) // Show form to edit a family member's details public function edit($id) { + // dd(123); $familyDetail = UserFamilyDetails::findOrFail($id); - return view('family-details.edit', compact('familyDetail')); + return view('family-details.edit',compact('familyDetail')); } // Update family member's details public function editData(Request $request, $id) { + $request->validate([ 'full_name' => 'required|string', 'relationship' => 'required|string', @@ -63,7 +65,7 @@ public function editData(Request $request, $id) 'phone_number' => 'nullable|string', 'occupation' => 'nullable|string', ]); - + // dd(1234); $familyDetail = UserFamilyDetails::findOrFail($id); $familyDetail->full_name = $request->input('full_name'); $familyDetail->relationship = $request->input('relationship'); @@ -93,9 +95,11 @@ public function deleteFamilyData(string $id){ ]); } - $familyDetail->update([ - 'delete_status' => 1 - ]); + // $familyDetail->update([ + // 'delete_status' => 1 + // ]); + $familyDetail->delete(); + return redirect()->back()->with('success', 'Family detail deleted successfully.'); } diff --git a/resources/views/family-details/edit.blade.php b/resources/views/family-details/edit.blade.php index d732362..13a82b9 100644 --- a/resources/views/family-details/edit.blade.php +++ b/resources/views/family-details/edit.blade.php @@ -1,173 +1,28 @@ - - @extends('layouts.template') -@section('breadcrumb') - @include('sweetalert::alert') +@section('content') +