mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 05:47:28 -08:00
Include asset maintenances in purge
This commit is contained in:
parent
4419dc7434
commit
be8049b41a
|
@ -62,15 +62,19 @@ class Purge extends Command
|
||||||
$assetcount = $assets->count();
|
$assetcount = $assets->count();
|
||||||
$this->info($assets->count().' assets purged.');
|
$this->info($assets->count().' assets purged.');
|
||||||
$asset_assoc = 0;
|
$asset_assoc = 0;
|
||||||
|
$asset_maintenances = 0;
|
||||||
|
|
||||||
foreach ($assets as $asset) {
|
foreach ($assets as $asset) {
|
||||||
$this->info('- Asset "'.$asset->showAssetName().'" deleted.');
|
$this->info('- Asset "'.$asset->showAssetName().'" deleted.');
|
||||||
$asset_assoc += $asset->assetlog()->count();
|
$asset_assoc += $asset->assetlog()->count();
|
||||||
$asset->assetlog()->forceDelete();
|
$asset->assetlog()->forceDelete();
|
||||||
|
$asset_maintenances += $asset->assetmaintenances()->count();
|
||||||
|
$asset->assetmaintenances()->forceDelete();
|
||||||
$asset->forceDelete();
|
$asset->forceDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info($asset_assoc.' corresponding log records purged.');
|
$this->info($asset_assoc.' corresponding log records purged.');
|
||||||
|
$this->info($asset_maintenances.' corresponding maintenance records purged.');
|
||||||
|
|
||||||
$locations = Location::whereNotNull('deleted_at')->withTrashed()->get();
|
$locations = Location::whereNotNull('deleted_at')->withTrashed()->get();
|
||||||
$this->info($locations->count().' locations purged.');
|
$this->info($locations->count().' locations purged.');
|
||||||
|
|
Loading…
Reference in a new issue