mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -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\Asset;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Carbon\Exceptions\InvalidFormatException;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
class StoreAssetRequest extends ImageUploadRequest
|
class StoreAssetRequest extends ImageUploadRequest
|
||||||
|
@ -29,9 +30,15 @@ class StoreAssetRequest extends ImageUploadRequest
|
||||||
: $this->company_id;
|
: $this->company_id;
|
||||||
|
|
||||||
if ($this->input('last_audit_date')) {
|
if ($this->input('last_audit_date')) {
|
||||||
|
try {
|
||||||
|
$lastAuditDate = Carbon::parse($this->input('last_audit_date'));
|
||||||
|
|
||||||
$this->merge([
|
$this->merge([
|
||||||
'last_audit_date' => Carbon::parse($this->input('last_audit_date'))->startOfDay()->format('Y-m-d H:i:s'),
|
'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([
|
$this->merge([
|
||||||
|
|
Loading…
Reference in a new issue