From 3eb7a87a666b35eac2c001c9dddb53ee65893acf Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Thu, 7 Apr 2022 11:24:12 -0700 Subject: [PATCH] fixes action_date for check-in not including H:i:s --- app/Http/Controllers/Assets/AssetCheckinController.php | 6 +++--- app/Models/Loggable.php | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Assets/AssetCheckinController.php b/app/Http/Controllers/Assets/AssetCheckinController.php index ec0ef1c365..913bf4bcf6 100644 --- a/app/Http/Controllers/Assets/AssetCheckinController.php +++ b/app/Http/Controllers/Assets/AssetCheckinController.php @@ -105,9 +105,9 @@ class AssetCheckinController extends Controller $asset->location_id = e($request->get('location_id')); } - $checkin_at = date('Y-m-d'); - if($request->filled('checkin_at')){ - $checkin_at = $request->input('checkin_at'); + $checkin_at = date('Y-m-d H:i:s'); + if (($request->filled('checkin_at')) && ($request->get('checkin_at') != date('Y-m-d'))) { + $checkin_at = $request->get('checkin_at'); } // Was the asset updated? diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php index d8b3e7f9a0..4d1eb1fd64 100644 --- a/app/Models/Loggable.php +++ b/app/Models/Loggable.php @@ -116,6 +116,9 @@ trait Loggable $log->location_id = null; $log->note = $note; $log->action_date = $action_date; + if (! $log->action_date) { + $log->action_date = date('Y-m-d H:i:s'); + } if (Auth::user()) { $log->user_id = Auth::user()->id;