mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Pass last_audit_date through for model level validation if not a date
This commit is contained in:
parent
675717ff82
commit
c98b9da612
|
@ -5,6 +5,7 @@ namespace App\Http\Requests;
|
|||
use App\Models\Asset;
|
||||
use App\Models\Company;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class StoreAssetRequest extends ImageUploadRequest
|
||||
|
@ -29,9 +30,15 @@ class StoreAssetRequest extends ImageUploadRequest
|
|||
: $this->company_id;
|
||||
|
||||
if ($this->input('last_audit_date')) {
|
||||
$this->merge([
|
||||
'last_audit_date' => Carbon::parse($this->input('last_audit_date'))->startOfDay()->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
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...
|
||||
}
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
|
|
Loading…
Reference in a new issue