Skip to content

A free open source IT asset/license management system

carbon thing

slong753321e7c93ec04
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 8975eeeba5..77f42696f7 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
@@ -1,5 +1,6 @@
<?php
+use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
@@ -32,7 +33,8 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
if ($model) {
$eol = $model->eol;
if ($eol) {
- $asset_eol_date = date('Y-m-d', strtotime($asset->asset_purchase_date . ' + ' . $eol . ' months'));
+ //getting rid of the weird date($asset->asset_purchase_date, strtotime('+'.$eol.' months') thing because it was weird
+ $asset_eol_date = Carbon::parse($asset->asset_purchase_date)->addMonths($eol)->format('Y-m-d');
DB::table('assets')->where('id', $asset->id)->update(['asset_eol_date' => $asset_eol_date]);
}
}