Use the observer to delete associated files and detach users

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2024-07-11 17:00:38 +01:00
parent d4a66f9b6c
commit c2fe3b5459
2 changed files with 25 additions and 1 deletions
@@ -182,7 +182,7 @@ class ConsumablesController extends Controller
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.not_found'));
}
$this->authorize($consumable);
$consumable->users()->detach();
$consumable->delete();
// Redirect to the locations management page
return redirect()->route('consumables.index')->with('success', trans('admin/consumables/message.delete.success'));