rm !empty

This commit is contained in:
spencerrlongg 2023-09-19 18:40:23 -05:00
parent 3cb906a05f
commit 2d59517c35

View file

@ -44,7 +44,7 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
// Update the asset_eol_date column with the calculated value if it doesn't exist
Asset::whereNull('asset_eol_date')->with('model')->chunkById(500, function ($assets) {
foreach ($assets as $asset) {
if (!empty($asset->model->eol) && !empty($asset->purchase_date)) {
if ($asset->model->eol && $asset->purchase_date) {
try {
$asset_eol_date = CarbonImmutable::parse($asset->purchase_date)->addMonths($asset->model->eol)->format('Y-m-d');
$asset->update(['asset_eol_date' => $asset_eol_date]);