From 638071dadda76bf481e90037e798a5cee435c13d Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 14 Feb 2024 10:14:38 +0000 Subject: [PATCH] Check the asset is not deleted when creating the permissions array Signed-off-by: snipe --- app/Http/Transformers/AssetMaintenancesTransformer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Transformers/AssetMaintenancesTransformer.php b/app/Http/Transformers/AssetMaintenancesTransformer.php index 114a2cc44d..88ac447c25 100644 --- a/app/Http/Transformers/AssetMaintenancesTransformer.php +++ b/app/Http/Transformers/AssetMaintenancesTransformer.php @@ -72,7 +72,7 @@ class AssetMaintenancesTransformer ]; $permissions_array['available_actions'] = [ - 'update' => Gate::allows('update', Asset::class), + 'update' => (Gate::allows('update', Asset::class) && ($assetmaintenance->asset->deleted_at=='')) ? true : false, 'delete' => Gate::allows('delete', Asset::class), ];