From f7bfc1373d6447dcd827be971cd5adc15cc8e25d Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 8 Jun 2026 10:56:35 +0530 Subject: [PATCH] Added logic for gate out entry for out time --- app/Filament/Pages/GateOutEntry.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/app/Filament/Pages/GateOutEntry.php b/app/Filament/Pages/GateOutEntry.php index ed37b84..4bad32c 100644 --- a/app/Filament/Pages/GateOutEntry.php +++ b/app/Filament/Pages/GateOutEntry.php @@ -54,15 +54,27 @@ class GateOutEntry extends Page implements HasForms $entry = VisitorEntry::where('register_id', $gatePass)->first(); if ($entry) { - $entry->out_time = now(); - $entry->save(); - Notification::make() - ->title('Gate Pass Processed') - ->body('Gate pass has been successfully processed. Visitor marked as exited.') - ->success() - ->send(); - $this->filters['scan_out_gate_pass'] = ''; + if (!empty($entry->out_time)) { + Notification::make() + ->title('Already Exited') + ->body('Gate pass has already been processed. Out time was already punched.') + ->warning() + ->send(); + $this->filters['scan_out_gate_pass'] = ''; + return; + } + else{ + $entry->out_time = now(); + $entry->save(); + + Notification::make() + ->title('Gate Pass Processed') + ->body('Gate pass has been successfully processed. Visitor marked as exited.') + ->success() + ->send(); + $this->filters['scan_out_gate_pass'] = ''; + } } else { Notification::make() ->title('Invalid Gate Pass') -- 2.49.1