From af307f413bb0b0f3370080b45351cb9fa16ad6e4 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Mon, 23 Oct 2023 11:34:46 +0700 Subject: [PATCH] update Logic Presence --- app/Http/Controllers/PresenceController.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 17843f4..5b2199b 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -135,13 +135,23 @@ class PresenceController extends Controller $checkLocation = $this->checkLocation($request); $statusBoundary = false; $date = date_create($request->time); + $statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first(); // assign and in boundary - if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ - $statusBoundary = true; + if (count($checkLocation) > 0 && $statusRestriction->status_boundary == true) + { + if ($checkLocation[0]['boundary'] == true) + { + $statusBoundary = true; + } else { + $statusBoundary = false; + } } - $statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first(); - if (!$statusRestriction->status_boundary) { - $statusBoundary = true; + // assign and not in boundary or in boundary + else { + if ($checkLocation[0]['boundary'] == true || $checkLocation[0]['boundary'] == false) + { + $statusBoundary = true; + } } // not assign if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false && $statusBoundary == false){