diff --git a/app/Http/Controllers/AssignMaterialController.php b/app/Http/Controllers/AssignMaterialController.php index 583d2cd..d037750 100644 --- a/app/Http/Controllers/AssignMaterialController.php +++ b/app/Http/Controllers/AssignMaterialController.php @@ -130,6 +130,7 @@ class AssignMaterialController extends Controller "m.description as material_name", "assign_material_to_activity.activity_id", "assign_material_to_activity.type", + "assign_material_to_activity.material_id" ) ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") ->groupBy("m.description") diff --git a/app/Http/Controllers/ReportActivityMaterialController.php b/app/Http/Controllers/ReportActivityMaterialController.php index 57ecfe3..5588235 100644 --- a/app/Http/Controllers/ReportActivityMaterialController.php +++ b/app/Http/Controllers/ReportActivityMaterialController.php @@ -29,10 +29,12 @@ class ReportActivityMaterialController extends Controller $data['assign_material_id'] = $request->assign_material_id; $data['qty'] = $this->sanitizeDecimal($data['qty']); - if(!ReportActivityMaterial::create($data)) - return response()->json(['status'=>'failed','message'=>'Input progress report activity failed created','code'=>400]); + $created = ReportActivityMaterial::create($data); - return response()->json(['status'=>'success','message'=>'Input progress report activity created','code'=>200]); + if(!$created) + return response()->json(['status'=>'failed','message'=>'Input progress report activity failed created','code'=>400,'data'=>null]); + + return response()->json(['status'=>'success','message'=>'Input progress report activity created','code'=>200,'data'=>array('report_id'=>$created->id)]); } public function updateStatusStartFinish(Request $request){