Rework service, removed redundant code, service invoicing improvements

This commit is contained in:
2024-07-29 23:12:53 +10:00
parent 5f10175b35
commit 0b5bc9e012
29 changed files with 474 additions and 523 deletions

View File

@@ -14,12 +14,23 @@ trait ScopeServiceActive
*/
public function scopeServiceActive($query)
{
return $query->where(function($q) {
return $q->where('services.active',TRUE)
->orWhere(function($q) {
return $q->whereNotNull('order_status')
->whereNotIn('services.order_status',Service::INACTIVE_STATUS);
});
});
return $query
->where(fn($q)=>
$q->where('services.active',TRUE)
->orWhere(fn($q)=>
$q->whereNotNull('order_status')
->whereNotIn('services.order_status',Service::INACTIVE_STATUS))
);
}
public function scopeServiceInactive($query)
{
return $query
->where(fn($q)=>
$q->where('services.active',FALSE)
->orWhere(fn($q)=>
$q->whereNotNull('order_status')
->whereIn('services.order_status',Service::INACTIVE_STATUS))
);
}
}