From be8049b41a7bd0fc094552ba6e8cbe5759093184 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 18 Aug 2016 07:06:15 -0700 Subject: [PATCH] Include asset maintenances in purge --- app/Console/Commands/Purge.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Console/Commands/Purge.php b/app/Console/Commands/Purge.php index de7b518fb5..8abe6048c9 100644 --- a/app/Console/Commands/Purge.php +++ b/app/Console/Commands/Purge.php @@ -62,15 +62,19 @@ class Purge extends Command $assetcount = $assets->count(); $this->info($assets->count().' assets purged.'); $asset_assoc = 0; + $asset_maintenances = 0; foreach ($assets as $asset) { $this->info('- Asset "'.$asset->showAssetName().'" deleted.'); $asset_assoc += $asset->assetlog()->count(); $asset->assetlog()->forceDelete(); + $asset_maintenances += $asset->assetmaintenances()->count(); + $asset->assetmaintenances()->forceDelete(); $asset->forceDelete(); } $this->info($asset_assoc.' corresponding log records purged.'); + $this->info($asset_maintenances.' corresponding maintenance records purged.'); $locations = Location::whereNotNull('deleted_at')->withTrashed()->get(); $this->info($locations->count().' locations purged.');