diff --git a/app/Http/Controllers/ReportActivityMaterialController.php b/app/Http/Controllers/ReportActivityMaterialController.php index d84c4fa..e451129 100644 --- a/app/Http/Controllers/ReportActivityMaterialController.php +++ b/app/Http/Controllers/ReportActivityMaterialController.php @@ -70,6 +70,17 @@ class ReportActivityMaterialController extends Controller "persentase_progress" => $sumReportActivityMaterial/$sumAssignMaterial*100, "updated_by" => $this->currentName ); + if ($sumReportActivityMaterial > 0) { + $data = []; + $reportActivityMaterial = ReportActivityMaterial::where('activity_id', $request->activity_id)->get(); + foreach ($reportActivityMaterial as $value) { + $data[] = $value; + } + $actualStartValues = array_column(array_filter($data, function($item) { + return isset($item['report_date']); + }), 'report_date'); + $dataUpdate["actual_start"] = min($actualStartValues); + } Activity::where('id', $request->activity_id)->update($dataUpdate); }