Skip to content

Commit 4c6249e

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 016900b + 8e11466 commit 4c6249e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

app/Http/Controllers/Api/LicenseSeatsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function index(Request $request, $licenseId) : JsonResponse | array
3434
}
3535

3636
if ($request->input('status') == 'assigned') {
37-
$seats->whereNotNull('license_seats.assigned_to')->whereNotNull('license_seats.asset_id');
37+
$seats->ByAssigned();
3838
}
3939

4040

app/Models/LicenseSeat.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,19 @@ public function scopeOrderDepartments($query, $order)
130130
->whereNotNull('license_seats.assigned_to')
131131
->orderBy('license_user_dept.name', $order);
132132
}
133+
134+
135+
public function scopeByAssigned($query)
136+
{
137+
138+
return $query->where(function ($query) {
139+
$query->whereNotNull('assigned_to')
140+
->orWhere(function($query)
141+
{
142+
$query->whereNotNull('asset_id');
143+
});
144+
});
145+
146+
}
147+
133148
}

0 commit comments

Comments
 (0)