diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php index 40dbf87f29..6b3f2f1d00 100644 --- a/app/Importer/AssetImporter.php +++ b/app/Importer/AssetImporter.php @@ -102,7 +102,7 @@ class AssetImporter extends ItemImporter $this->item['expected_checkin'] = trim($this->findCsvMatch($row, 'expected_checkin')); $this->item['last_audit_date'] = trim($this->findCsvMatch($row, 'last_audit_date')); $this->item['next_audit_date'] = trim($this->findCsvMatch($row, 'next_audit_date')); - $this->item['asset_eol_date'] = trim($this->findCsvMatch($row, 'next_audit_date')); + $this->item['asset_eol_date'] = trim($this->findCsvMatch($row, 'asset_eol_date')); $this->item['asset_tag'] = $asset_tag; // We need to save the user if it exists so that we can checkout to user later. diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 0ef88c5c44..dbcd71462d 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -100,7 +100,7 @@ class Asset extends Depreciable 'last_checkout' => 'nullable|date_format:Y-m-d H:i:s', 'last_checkin' => 'nullable|date_format:Y-m-d H:i:s', 'expected_checkin' => 'nullable|date', - 'last_audit_date' => 'nullable|date_format:Y-m-d H:i:s', + 'last_audit_date' => 'nullable', // 'next_audit_date' => 'nullable|date|after:last_audit_date', 'next_audit_date' => 'nullable|date', 'location_id' => 'nullable|exists:locations,id', @@ -984,6 +984,14 @@ class Asset extends Depreciable ); } + protected function lastAuditDate(): Attribute + { + return Attribute::make( + get: fn ($value) => $value ? Carbon::parse($value)->format('Y-m-d H:i:s') : null, + set: fn ($value) => $value ? Carbon::parse($value)->format('Y-m-d H:i:s') : null, + ); + } + protected function lastCheckout(): Attribute { return Attribute::make(