From 72661df9bffb85361f7e21569c3931633da98b59 Mon Sep 17 00:00:00 2001 From: Muhammad Sulaiman Yusuf Date: Wed, 20 Jul 2022 00:24:15 +0700 Subject: [PATCH] trim description whitespace --- app/Http/Controllers/AssignMaterialController.php | 8 +++++++- app/Http/Controllers/MaterialResourceController.php | 7 ++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/AssignMaterialController.php b/app/Http/Controllers/AssignMaterialController.php index cf87352..a3a7991 100644 --- a/app/Http/Controllers/AssignMaterialController.php +++ b/app/Http/Controllers/AssignMaterialController.php @@ -120,7 +120,13 @@ class AssignMaterialController extends Controller public function datatablesForReportActivity(Request $request){ $id_activity = $request->query('idact'); - $data = AssignMaterial::select(AssignMaterial::raw('SUM(qty_planning) as qty_planning'), "m.description as material_name", "assign_material_to_activity.activity_id as activity_id") + $data = + AssignMaterial::select( + AssignMaterial::raw( + 'SUM(qty_planning) as qty_planning'), + "m.description as material_name", + "assign_material_to_activity.activity_id as activity_id" + ) ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") ->groupBy("m.description") ->groupBy("assign_material_to_activity.activity_id") diff --git a/app/Http/Controllers/MaterialResourceController.php b/app/Http/Controllers/MaterialResourceController.php index 5975279..f7fa569 100644 --- a/app/Http/Controllers/MaterialResourceController.php +++ b/app/Http/Controllers/MaterialResourceController.php @@ -18,6 +18,7 @@ class MaterialResourceController extends Controller ]); $data = $request->all(); + $data['description'] = trim($data['description']); $data['created_by'] = $this->currentName; @@ -59,8 +60,8 @@ class MaterialResourceController extends Controller return response()->json(['status'=>'failed','message'=>'data material resource not found!','code'=>400], 400); die(); } - - + + if($result){ return response()->json(['status'=>'success','message'=>'data material resource successfully updated!','code'=>200], 200); }else{ @@ -78,7 +79,7 @@ class MaterialResourceController extends Controller return response()->json(['status'=>'failed','message'=>'data material resource not found!','code'=>400], 400); die(); } - + if($delete){ return response()->json(['status'=>'success','message'=>'data material resource successfully deleted!','code'=>200], 200);