mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -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)
|
? Company::getIdForCurrentUser($this->company_id)
|
||||||
: $this->company_id;
|
: $this->company_id;
|
||||||
|
|
||||||
if ($this->input('last_audit_date')) {
|
$this->formatLastAuditDate();
|
||||||
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->merge([
|
$this->merge([
|
||||||
'asset_tag' => $this->asset_tag ?? Asset::autoincrement_asset(),
|
'asset_tag' => $this->asset_tag ?? Asset::autoincrement_asset(),
|
||||||
|
@ -64,4 +52,21 @@ class StoreAssetRequest extends ImageUploadRequest
|
||||||
|
|
||||||
return $rules;
|
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