Disallow deleting category if there are licenses

This commit is contained in:
snipe 2018-07-05 18:02:25 -07:00
parent 4099c06b27
commit a44bd9abe0

View file

@ -41,7 +41,7 @@ class CategoriesTransformer
$permissions_array['available_actions'] = [ $permissions_array['available_actions'] = [
'update' => Gate::allows('update', Category::class) ? true : false, 'update' => Gate::allows('update', Category::class) ? true : false,
'delete' => (Gate::allows('delete', Category::class) && ($category->assets_count == 0) && ($category->accessories_count == 0) && ($category->consumables_count == 0) && ($category->components_count == 0)) ? true : false, 'delete' => (Gate::allows('delete', Category::class) && ($category->assets_count == 0) && ($category->accessories_count == 0) && ($category->consumables_count == 0) && ($category->components_count == 0) && ($category->licenses_count == 0)) ? true : false,
]; ];
$array += $permissions_array; $array += $permissions_array;