From 2204ea5ef81ec0e27cc41b73462a5f25a38ddb16 Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 13 Sep 2023 15:21:16 +0700 Subject: [PATCH] sync report quick fix --- app/Http/Controllers/ProjectController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 5e0fbde..6fe1c12 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use DateTime; use Illuminate\Http\Request; use App\Models\Project; use App\Models\UserToProyek; @@ -349,7 +350,16 @@ class ProjectController extends Controller } public static function setSyncDate($activity_id, $activity, $report) { - $status = AssignMaterial::select('status_activity')->where('activity_id', $activity_id)->first(); + $status = AssignMaterial::where('activity_id', $activity_id)->first(); + if (!isset($status)) { + $reports = array( + 'activity_id' => $activity_id, + 'min_date' => new DateTime($activity->start_date), + 'max_date' => new DateTime($activity->end_date), + 'status' => 'open' + ); + return $reports; + } if (!isset($status->status_activity)) { $status->status_activity = 'open'; }