Improved - disallow deleting manufactureres if there are associated items

This is enforced on the backend - UI imorovement only
This commit is contained in:
snipe 2017-12-12 06:52:50 -08:00
parent 9179b6d9c4
commit 856a760d89

View file

@ -40,7 +40,7 @@ class ManufacturersTransformer
$permissions_array['available_actions'] = [
'update' => Gate::allows('update', Manufacturer::class) ? true : false,
'delete' => Gate::allows('delete', Manufacturer::class) ? true : false,
'delete' => (Gate::allows('delete', Manufacturer::class) && ($manufacturer->assets_count == 0) && ($manufacturer->licenses_count==0) && ($manufacturer->consumables_count==0) && ($manufacturer->accessories_count==0) && ($manufacturer->deleted_at=='')) ? true : false,
];
$array += $permissions_array;