Expand search with negated search options

This commit is contained in:
James Cole
2022-09-25 15:31:07 +02:00
parent 80a732b32b
commit 3c33ea959e
8 changed files with 1570 additions and 108 deletions

View File

@@ -51,6 +51,20 @@ trait AmountCollection
return $this;
}
/**
* @inheritDoc
*/
public function amountIsNot(string $amount): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($amount) {
$q->where('source.amount','!=', app('steam')->negative($amount));
}
);
return $this;
}
/**
* Get transactions where the amount is less than.
*
@@ -106,6 +120,25 @@ trait AmountCollection
return $this;
}
/**
* Get transactions with a specific foreign amount.
*
* @param string $amount
*
* @return GroupCollectorInterface
*/
public function foreignAmountIsNot(string $amount): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($amount) {
$q->whereNull('source.foreign_amount');
$q->orWhere('source.foreign_amount','!=', app('steam')->negative($amount));
}
);
return $this;
}
/**
* Get transactions where the amount is less than.
*