Merge pull request #14729 from snipe/fixes/attribute_for_purchase_date
Sets purchase date as date (versus datetime) in labels
This commit is contained in:
commit
84a601f364
1 changed files with 5 additions and 0 deletions
|
@ -28,6 +28,11 @@ class FieldOption {
|
||||||
return $asset->assignedTo ? $asset->assignedTo->present()->fullName() : null;
|
return $asset->assignedTo ? $asset->assignedTo->present()->fullName() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle Laravel's stupid Carbon datetime casting
|
||||||
|
if ($dataPath[0] === 'purchase_date') {
|
||||||
|
return $asset->purchase_date ? $asset->purchase_date->format('Y-m-d') : null;
|
||||||
|
}
|
||||||
|
|
||||||
return $dataPath->reduce(function ($myValue, $path) {
|
return $dataPath->reduce(function ($myValue, $path) {
|
||||||
try { return $myValue ? $myValue->{$path} : ${$myValue}; }
|
try { return $myValue ? $myValue->{$path} : ${$myValue}; }
|
||||||
catch (\Exception $e) { return $myValue; }
|
catch (\Exception $e) { return $myValue; }
|
||||||
|
|
Loading…
Add table
Reference in a new issue