Skip to content

Commit

Permalink
Disallow deleting category if there are licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Jul 6, 2018
1 parent 4099c06 commit a44bd9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Transformers/CategoriesTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function transformCategory (Category $category = null)

$permissions_array['available_actions'] = [
'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;
Expand Down

0 comments on commit a44bd9a

Please sign in to comment.