Code refactor work. New optimised query to get invoice status summary for an account
This commit is contained in:
@@ -57,16 +57,18 @@ class Charge extends Model
|
||||
|
||||
/* SCOPES */
|
||||
|
||||
/** @deprecated use pending */
|
||||
public function scopeUnprocessed($query)
|
||||
{
|
||||
return $this->scopePending();
|
||||
}
|
||||
|
||||
public function scopePending($query) {
|
||||
return $query
|
||||
->where('active',TRUE)
|
||||
->active()
|
||||
->whereNotNull('charge_at')
|
||||
->whereNotNull('type')
|
||||
->where(function($q) {
|
||||
return $q->where('processed',FALSE)
|
||||
->orWhereNull('processed');
|
||||
});
|
||||
->where(fn($query)=>$query->where('processed',FALSE)->orWhereNull('processed'));
|
||||
}
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
Reference in New Issue
Block a user