Add test coverage to ensure filters don't unexpectedly get broken
This commit is contained in:
parent
40d44598da
commit
cd3572730b
2 changed files with 102 additions and 2 deletions
|
@ -48,12 +48,12 @@ class MultiFieldServerFilter implements Filter
|
|||
function (Builder $builder) use ($parts) {
|
||||
$builder->orWhere('allocations.ip', $parts[0]);
|
||||
if (!is_null($parts[1] ?? null)) {
|
||||
$builder->where('allocations.port', 'LIKE', "%{$parts[1]}");
|
||||
$builder->where('allocations.port', 'LIKE', "{$parts[1]}%");
|
||||
}
|
||||
},
|
||||
// Otherwise, just try to search for that specific port in the allocations.
|
||||
function (Builder $builder) use ($value) {
|
||||
$builder->orWhere('allocations.port', substr($value, 1));
|
||||
$builder->orWhere('allocations.port', 'LIKE', substr($value, 1) . '%');
|
||||
}
|
||||
);
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue