fixing the unknown tab to list the transactions of is_mapped false and also mapped and status in rejected

This commit is contained in:
Steve Ng
2023-10-26 00:01:10 +08:00
parent 910f190075
commit f47c3c9ecc
2 changed files with 6 additions and 3 deletions
@@ -16,9 +16,7 @@ class IsMappedFalseOrMappedButStatusIn implements Filter
{
return $builder->where(function($q) use ($value) {
$q->whereDoesntHave('owners');
$q->orwhereHas('owners', function($query) use ($value) {
$query->whereIn('status', $value);
});
$q->orwhereDoesntHave('owner_status');
});
}
+5
View File
@@ -49,6 +49,11 @@ class StatementTransaction extends Model
return $this->hasMany(StatementTransactionOwner::class);
}
public function owner_status()
{
return $this->owners()->whereIn('status',[ApprovalStatus::APPROVED,ApprovalStatus::COMPLETED,ApprovalStatus::PENDING_VERIFICATION]);
}
public function scopeDoesntMapStatement($query)
{
$query->whereDoesntHave('owners', function($query){