asset update logic

This commit is contained in:
slong753 2023-07-17 14:44:09 -05:00 committed by spencerrlongg
parent 41b65bd9a2
commit cda9dd57dd

View file

@ -312,9 +312,12 @@ class AssetsController extends Controller
$asset->purchase_cost = $request->input('purchase_cost', null);
if ($request->filled('purchase_date') && !$request->filled('asset_eol_date')) {
$asset->asset_eol_date = Carbon::parse($request->input('purchase_date'))->addMonths($asset->model->eol)->format('Y-m-d');
} else {
} elseif ($request->filled('asset_eol_date')) {
$asset->explicit_eol = request('explicit_eol', null);
}
else {
$asset->purchase_date = $request->input('purchase_date', null);
$asset->asset_eol_date = request('asset_eol_date', null);
$asset->asset_eol_date = request('asset_eol_date', $asset->present()->eol_date());
}