not all working, but pushing to work on something else

This commit is contained in:
spencerrlongg
2024-03-05 11:02:55 -06:00
parent c025e25839
commit eac01868ca
2 changed files with 7 additions and 8 deletions
@@ -622,10 +622,9 @@ class AssetsController extends Controller
* @since [v4.0]
* @return \Illuminate\Http\JsonResponse
*/
public function update(UpdateAssetRequest $request, Asset $id)
public function update(UpdateAssetRequest $request, Asset $asset)
{
if ($asset = Asset::find($id)) {
$asset->fill($request->validated());
$asset->update($request->validated());
// TODO: how much of this should go to validator?
($request->filled('model_id')) ?
@@ -689,11 +688,8 @@ class AssetsController extends Controller
}
return response()->json(Helper::formatStandardApiResponse('error', null, $asset->getErrors()), 200);
}
// TODO: can this be moved up to ModelNotFound exception handler? would remove a couple lines here if we could use laravel's awesome route-model binding.
// (would also need to confirm that then _everything_ expects a 200 when a model isn't found)
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.does_not_exist')), 200);
// TODO: confirm that everything expects a _200_ model not found exception
}