Added a few more scopes

This commit is contained in:
snipe
2026-05-18 15:32:00 +01:00
parent 57b257057a
commit 96a42d0f33
2 changed files with 11 additions and 1 deletions
@@ -8,6 +8,16 @@ use Illuminate\Database\Eloquent\Builder;
class MaintenanceQueryBuilder extends Builder
{
public function active(): static
{
return $this->whereNull('maintenances.completed_at');
}
public function completed(): static
{
return $this->whereNotNull('maintenances.completed_at');
}
public function dueForCompletion(Setting $settings): static
{
$interval = (int) ($settings->audit_warning_days ?? 0);
+1 -1
View File
@@ -299,7 +299,7 @@
<x-well class="well-sm">
<div class="well-display">
<x-data-row icon_type="maintenances" label="Active Maintenances" align="right">
{{ $asset->maintenances->whereNull('completion_date')->count() }}
{{ $asset->maintenances()->active()->count() }}
</x-data-row>
<x-data-row icon_type="checkout" :label="trans('general.checkouts_count')" align="right">