mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-23 12:44:12 -08:00
Little bit of clean up
This commit is contained in:
parent
a2625c889a
commit
71722b753d
|
@ -29,19 +29,7 @@ class StoreAssetRequest extends ImageUploadRequest
|
|||
? Company::getIdForCurrentUser($this->company_id)
|
||||
: $this->company_id;
|
||||
|
||||
if ($this->input('last_audit_date')) {
|
||||
try {
|
||||
$lastAuditDate = Carbon::parse($this->input('last_audit_date'));
|
||||
|
||||
$this->merge([
|
||||
'last_audit_date' => $lastAuditDate->startOfDay()->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
} catch (InvalidFormatException $e) {
|
||||
// we don't need to do anything here...
|
||||
// we'll keep the provided date in an
|
||||
// invalid format so validation picks it up later
|
||||
}
|
||||
}
|
||||
$this->formatLastAuditDate();
|
||||
|
||||
$this->merge([
|
||||
'asset_tag' => $this->asset_tag ?? Asset::autoincrement_asset(),
|
||||
|
@ -64,4 +52,21 @@ class StoreAssetRequest extends ImageUploadRequest
|
|||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
private function formatLastAuditDate(): void
|
||||
{
|
||||
if ($this->input('last_audit_date')) {
|
||||
try {
|
||||
$lastAuditDate = Carbon::parse($this->input('last_audit_date'));
|
||||
|
||||
$this->merge([
|
||||
'last_audit_date' => $lastAuditDate->startOfDay()->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
} catch (InvalidFormatException $e) {
|
||||
// we don't need to do anything here...
|
||||
// we'll keep the provided date in an
|
||||
// invalid format so validation picks it up later
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue