Skip to content

A free open source IT asset/license management system

Add order scope to query

snipeec2eddf53821
diff --git a/app/Console/Commands/SendExpirationAlerts.php b/app/Console/Commands/SendExpirationAlerts.php
index b8e16e57e6..44ca9dce65 100644
--- a/app/Console/Commands/SendExpirationAlerts.php
+++ b/app/Console/Commands/SendExpirationAlerts.php
@@ -85,7 +85,10 @@ class SendExpirationAlerts extends Command
}
// Expiring licenses
- $licenses = License::query()->ExpiredLicenses($alert_interval)->get();
+ $licenses = License::query()->ExpiringLicenses($alert_interval)
+ ->orderBy('expiration_date', 'ASC')
+ ->orderBy('termination_date', 'ASC')
+ ->get();
if ($licenses->count() > 0) {
Mail::to($recipients)->send(new ExpiringLicenseMail($licenses, $alert_interval));