Merge pull request #9946 from firefly-iii/fix-currency-autocomplete

Add missing method to repository.
This commit is contained in:
James Cole
2025-03-08 05:57:19 +01:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@@ -38,6 +38,16 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
{
use UserGroupTrait;
public function searchCurrency(string $search, int $limit): Collection
{
$query = TransactionCurrency::where('enabled', true);
if ('' !== $search) {
$query->whereLike('name', sprintf('%%%s%%', $search));
}
return $query->take($limit)->get();
}
#[\Override]
public function find(int $currencyId): ?TransactionCurrency
{

View File

@@ -34,6 +34,7 @@ use Illuminate\Support\Collection;
interface CurrencyRepositoryInterface
{
public function find(int $currencyId): ?TransactionCurrency;
public function searchCurrency(string $search, int $limit): Collection;
/**
* Find by currency code, return NULL if unfound.