Browse Source

trim description whitespace

pull/3/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
72661df9bf
  1. 8
      app/Http/Controllers/AssignMaterialController.php
  2. 7
      app/Http/Controllers/MaterialResourceController.php

8
app/Http/Controllers/AssignMaterialController.php

@ -120,7 +120,13 @@ class AssignMaterialController extends Controller
public function datatablesForReportActivity(Request $request){ public function datatablesForReportActivity(Request $request){
$id_activity = $request->query('idact'); $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") ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
->groupBy("m.description") ->groupBy("m.description")
->groupBy("assign_material_to_activity.activity_id") ->groupBy("assign_material_to_activity.activity_id")

7
app/Http/Controllers/MaterialResourceController.php

@ -18,6 +18,7 @@ class MaterialResourceController extends Controller
]); ]);
$data = $request->all(); $data = $request->all();
$data['description'] = trim($data['description']);
$data['created_by'] = $this->currentName; $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); return response()->json(['status'=>'failed','message'=>'data material resource not found!','code'=>400], 400);
die(); die();
} }
if($result){ if($result){
return response()->json(['status'=>'success','message'=>'data material resource successfully updated!','code'=>200], 200); return response()->json(['status'=>'success','message'=>'data material resource successfully updated!','code'=>200], 200);
}else{ }else{
@ -78,7 +79,7 @@ class MaterialResourceController extends Controller
return response()->json(['status'=>'failed','message'=>'data material resource not found!','code'=>400], 400); return response()->json(['status'=>'failed','message'=>'data material resource not found!','code'=>400], 400);
die(); die();
} }
if($delete){ if($delete){
return response()->json(['status'=>'success','message'=>'data material resource successfully deleted!','code'=>200], 200); return response()->json(['status'=>'success','message'=>'data material resource successfully deleted!','code'=>200], 200);

Loading…
Cancel
Save