Skip to content

A free open source IT asset/license management system

use query builder instead of model for update to skip observer

spencerrlongg0d853f931d67
diff --git a/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php b/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php
index f9c7b3d811..146e5b2d71 100644
--- a/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php
+++ b/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php
@@ -36,10 +36,12 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
}
if ($asset->model->eol) {
if ($months != $asset->model->eol) {
- $asset->update(['eol_explicit' => true]);
+ DB::table('assets')->where('id', $asset->id)->update(['eol_explicit' => true]);
}
- } else {
- $asset->update(['eol_explicit' => true]);
+ }
+ // if there is NO model eol, but there is a purchase date and an asset_eol_date (which is what is left over) the asset_eol_date has still been explicitly set
+ else {
+ DB::table('assets')->where('id', $asset->id)->update(['eol_explicit' => true]);
}
}
}