aha, got it working.

This commit is contained in:
spencerrlongg 2024-03-08 19:48:47 -06:00
parent b239b3a4db
commit c8341d9dc4
2 changed files with 4 additions and 3 deletions

View file

@ -626,8 +626,10 @@ class AssetsController extends Controller
$asset->fill($request->validated());
// TODO: how much of this can go in the validator?
($request->filled('model_id')) ?
$asset->model()->associate(AssetModel::find($request->get('model_id'))) : null;
// this is _always_ filled now, see UpdateAssetRequest
// i'm leaving this here for now, but when would we ever want model_id to be `null`??
($request->validated()['model_id']) ?
$asset->model()->associate(AssetModel::find($request->validated()['model_id'])) : null;
($request->filled('rtd_location_id')) ?
$asset->location_id = $request->get('rtd_location_id') : '';
($request->filled('company_id')) ?

View file

@ -38,7 +38,6 @@ class UpdateAssetRequest extends ImageUploadRequest
$rules = array_merge(
(new Asset())->getRules(),
parent::rules(),
//['model_id' => 'required|integer|exists:models,id,deleted_at,NULL|not_array']
);
return $rules;