Skip to content

Commit 50a5ee4

Browse files
committed
fixes warranty part of query
1 parent 6134ca0 commit 50a5ee4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/Models/Asset.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,10 @@ public static function getExpiringWarrantyOrEol($days = 30)
950950
})->orWhere(function ($query) use ($days) {
951951
$query->whereNotNull('purchase_date')
952952
->whereNotNull('warranty_months')
953-
->whereBetween('purchase_date', [Carbon::now(), Carbon::now()->addMonths('assets.warranty_months')->addDays($days)]);
953+
->whereRaw(
954+
'DATE_ADD(purchase_date, INTERVAL warranty_months MONTH) BETWEEN ? AND ?',
955+
[now(), now()->addDays($days)]
956+
);
954957
});
955958
})
956959
->orderBy('asset_eol_date', 'ASC')

0 commit comments

Comments
 (0)