Skip to content

Firefly III: a personal finances manager

Fix https://github.com/orgs/firefly-iii/discussions/9324

James Coleb41fc43e6458
diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php
index cc359db009..c8a249e80d 100644
--- a/app/Factory/BillFactory.php
+++ b/app/Factory/BillFactory.php
@@ -126,7 +126,7 @@ class BillFactory
public function findByName(string $name): ?Bill
{
- return $this->user->bills()->where('name', 'LIKE', sprintf('%%%s%%', $name))->first();
+ return $this->user->bills()->whereLike('name', sprintf('%%%s%%', $name))->first();
}
public function setUser(User $user): void
diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php
index 0fef0ff2c0..a2febb88c6 100644
--- a/app/Helpers/Collector/Extensions/MetaCollection.php
+++ b/app/Helpers/Collector/Extensions/MetaCollection.php
@@ -221,7 +221,7 @@ trait MetaCollection
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s%%', $externalId));
+ $this->query->whereLike('journal_meta.data', sprintf('%%%s%%', $externalId));
return $this;
}
@@ -257,7 +257,7 @@ trait MetaCollection
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('"%s%%', $externalId));
+ $this->query->whereLike('journal_meta.data', sprintf('"%s%%', $externalId));
return $this;
}
@@ -269,7 +269,7 @@ trait MetaCollection
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s"', $externalId));
+ $this->query->whereLike('journal_meta.data', sprintf('%%%s"', $externalId));
return $this;
}
@@ -281,7 +281,7 @@ trait MetaCollection
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('"%s%%', $externalId));
+ $this->query->whereLike('journal_meta.data', sprintf('"%s%%', $externalId));
return $this;
}
@@ -292,7 +292,7 @@ trait MetaCollection
$url = (string)json_encode($url);
$url = str_replace('\\', '\\\\', trim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s%%', $url));
+ $this->query->whereLike('journal_meta.data', sprintf('%%%s%%', $url));
return $this;
}
@@ -338,7 +338,7 @@ trait MetaCollection
$url = (string)json_encode($url);
$url = str_replace('\\', '\\\\', ltrim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s', $url));
+ $this->query->whereLike('journal_meta.data', sprintf('%%%s', $url));
return $this;
}
@@ -351,7 +351,7 @@ trait MetaCollection
// var_dump($url);
$this->query->where('journal_meta.name', '=', 'external_url');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('%s%%', $url));
+ $this->query->whereLike('journal_meta.data', sprintf('%s%%', $url));
return $this;
}
@@ -404,7 +404,7 @@ trait MetaCollection
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s%%', $internalReference));
+ $this->query->whereLike('journal_meta.data', sprintf('%%%s%%', $internalReference));
return $this;
}
@@ -440,7 +440,7 @@ trait MetaCollection
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('"%s%%', $internalReference));
+ $this->query->whereLike('journal_meta.data', sprintf('"%s%%', $internalReference));
return $this;
}
@@ -452,7 +452,7 @@ trait MetaCollection
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s"', $internalReference));
+ $this->query->whereLike('journal_meta.data', sprintf('%%%s"', $internalReference));
return $this;
}
@@ -464,7 +464,7 @@ trait MetaCollection
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
- $this->query->where('journal_meta.data', 'LIKE', sprintf('"%s%%', $internalReference));
+ $this->query->whereLike('journal_meta.data', sprintf('"%s%%', $internalReference));
return $this;
}
@@ -472,7 +472,7 @@ trait MetaCollection
public function notesContain(string $value): GroupCollectorInterface
{
$this->withNotes();
- $this->query->where('notes.text', 'LIKE', sprintf('%%%s%%', $value));
+ $this->query->whereLike('notes.text', sprintf('%%%s%%', $value));
return $this;
}
@@ -533,7 +533,7 @@ trait MetaCollection
public function notesEndWith(string $value): GroupCollectorInterface
{
$this->withNotes();
- $this->query->where('notes.text', 'LIKE', sprintf('%%%s', $value));
+ $this->query->whereLike('notes.text', sprintf('%%%s', $value));
return $this;
}
@@ -560,7 +560,7 @@ trait MetaCollection
public function notesStartWith(string $value): GroupCollectorInterface
{
$this->withNotes();
- $this->query->where('notes.text', 'LIKE', sprintf('%s%%', $value));
+ $this->query->whereLike('notes.text', sprintf('%s%%', $value));
return $this;
}
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index ba86169775..ea0f18e02e 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -210,7 +210,7 @@ class GroupCollector implements GroupCollectorInterface
static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) {
$keyword = sprintf('%%%s', $word);
- $q1->where('transaction_journals.description', 'LIKE', $keyword);
+ $q1->whereLike('transaction_journals.description', $keyword);
}
}
);
@@ -218,7 +218,7 @@ class GroupCollector implements GroupCollectorInterface
static function (EloquentBuilder $q2) use ($array): void {
foreach ($array as $word) {
$keyword = sprintf('%%%s', $word);
- $q2->where('transaction_groups.title', 'LIKE', $keyword);
+ $q2->whereLike('transaction_groups.title', $keyword);
}
}
);
@@ -265,7 +265,7 @@ class GroupCollector implements GroupCollectorInterface
static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) {
$keyword = sprintf('%s%%', $word);
- $q1->where('transaction_journals.description', 'LIKE', $keyword);
+ $q1->whereLike('transaction_journals.description', $keyword);
}
}
);
@@ -273,7 +273,7 @@ class GroupCollector implements GroupCollectorInterface
static function (EloquentBuilder $q2) use ($array): void {
foreach ($array as $word) {
$keyword = sprintf('%s%%', $word);
- $q2->where('transaction_groups.title', 'LIKE', $keyword);
+ $q2->whereLike('transaction_groups.title', $keyword);
}
}
);
@@ -944,7 +944,7 @@ class GroupCollector implements GroupCollectorInterface
static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) {
$keyword = sprintf('%%%s%%', $word);
- $q1->where('transaction_journals.description', 'LIKE', $keyword);
+ $q1->whereLike('transaction_journals.description', $keyword);
}
}
);
@@ -952,7 +952,7 @@ class GroupCollector implements GroupCollectorInterface
static function (EloquentBuilder $q2) use ($array): void {
foreach ($array as $word) {
$keyword = sprintf('%%%s%%', $word);
- $q2->where('transaction_groups.title', 'LIKE', $keyword);
+ $q2->whereLike('transaction_groups.title', $keyword);
}
}
);
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 5327ecc724..b2633cd70c 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -576,7 +576,7 @@ class AccountRepository implements AccountRepositoryInterface
$parts = explode(' ', $query);
foreach ($parts as $part) {
$search = sprintf('%%%s%%', $part);
- $dbQuery->where('name', 'LIKE', $search);
+ $dbQuery->whereLike('name', $search);
}
}
if (0 !== count($types)) {
@@ -604,11 +604,11 @@ class AccountRepository implements AccountRepositoryInterface
$search = sprintf('%%%s%%', $part);
$dbQuery->where(
static function (EloquentBuilder $q1) use ($search): void { // @phpstan-ignore-line
- $q1->where('accounts.iban', 'LIKE', $search);
+ $q1->whereLike('accounts.iban', $search);
$q1->orWhere(
static function (EloquentBuilder $q2) use ($search): void {
$q2->where('account_meta.name', '=', 'account_number');
- $q2->where('account_meta.data', 'LIKE', $search);
+ $q2->whereLike('account_meta.data', $search);
}
);
}
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index d078d79432..08824f8ac9 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -57,7 +57,7 @@ class BillRepository implements BillRepositoryInterface
{
$search = $this->user->bills();
if ('' !== $query) {
- $search->where('name', 'LIKE', sprintf('%%%s', $query));
+ $search->whereLike('name', sprintf('%%%s', $query));
}
$search->orderBy('name', 'ASC')
->where('active', true)
@@ -70,7 +70,7 @@ class BillRepository implements BillRepositoryInterface
{
$search = $this->user->bills();
if ('' !== $query) {
- $search->where('name', 'LIKE', sprintf('%s%%', $query));
+ $search->whereLike('name', sprintf('%s%%', $query));
}
$search->orderBy('name', 'ASC')
->where('active', true)
@@ -485,7 +485,7 @@ class BillRepository implements BillRepositoryInterface
{
$query = sprintf('%%%s%%', $query);
- return $this->user->bills()->where('name', 'LIKE', $query)->take($limit)->get();
+ return $this->user->bills()->whereLike('name', $query)->take($limit)->get();
}
public function setObjectGroup(Bill $bill, string $objectGroupTitle): Bill
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index 771183bec8..3878b02636 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -57,7 +57,7 @@ class BudgetRepository implements BudgetRepositoryInterface
{
$search = $this->user->budgets();
if ('' !== $query) {
- $search->where('name', 'LIKE', sprintf('%%%s', $query));
+ $search->whereLike('name', sprintf('%%%s', $query));
}
$search->orderBy('order', 'ASC')
->orderBy('name', 'ASC')->where('active', true)
@@ -70,7 +70,7 @@ class BudgetRepository implements BudgetRepositoryInterface
{
$search = $this->user->budgets();
if ('' !== $query) {
- $search->where('name', 'LIKE', sprintf('%s%%', $query));
+ $search->whereLike('name', sprintf('%s%%', $query));
}
$search->orderBy('order', 'ASC')
->orderBy('name', 'ASC')->where('active', true)
@@ -512,7 +512,7 @@ class BudgetRepository implements BudgetRepositoryInterface
}
$query = sprintf('%%%s%%', $name);
- return $this->user->budgets()->where('name', 'LIKE', $query)->first();
+ return $this->user->budgets()->whereLike('name', $query)->first();
}
/**
@@ -577,7 +577,7 @@ class BudgetRepository implements BudgetRepositoryInterface
{
$search = $this->user->budgets();
if ('' !== $query) {
- $search->where('name', 'LIKE', sprintf('%%%s%%', $query));
+ $search->whereLike('name', sprintf('%%%s%%', $query));
}
$search->orderBy('order', 'ASC')
->orderBy('name', 'ASC')->where('active', true)
diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php
index c4312c833c..86ad7e3f24 100644
--- a/app/Repositories/Category/CategoryRepository.php
+++ b/app/Repositories/Category/CategoryRepository.php
@@ -49,7 +49,7 @@ class CategoryRepository implements CategoryRepositoryInterface
{
$search = $this->user->categories();
if ('' !== $query) {
- $search->where('name', 'LIKE', sprintf('%%%s', $query));
+ $search->whereLike('name', sprintf('%%%s', $query));
}
return $search->take($limit)->get();
@@ -59,7 +59,7 @@ class CategoryRepository implements CategoryRepositoryInterface
{
$search = $this->user->categories();
if ('' !== $query) {
- $search->where('name', 'LIKE', sprintf('%s%%', $query));
+ $search->whereLike('name', sprintf('%s%%', $query));
}
return $search->take($limit)->get();
@@ -344,7 +344,7 @@ class CategoryRepository implements CategoryRepositoryInterface
{
$search = $this->user->categories();
if ('' !== $query) {
- $search->where('name', 'LIKE', sprintf('%%%s%%', $query));
+ $search->whereLike('name', sprintf('%%%s%%', $query));
}
return $search->take($limit)->get();
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index ea80eed79b..e8d19790cb 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -197,7 +197,7 @@ class JournalRepository implements JournalRepositoryInterface
->orderBy('date', 'DESC')
;
if ('' !== $search) {
- $query->where('description', 'LIKE', sprintf('%%%s%%', $search));
+ $query->whereLike('description', sprintf('%%%s%%', $search));
}
return $query->take($limit)->get();
diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepository.php b/app/Repositories/ObjectGroup/ObjectGroupRepository.php
index 2d60e7eace..7bb97a861d 100644
--- a/app/Repositories/ObjectGroup/ObjectGroupRepository.php
+++ b/app/Repositories/ObjectGroup/ObjectGroupRepository.php
@@ -120,7 +120,7 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
$parts = explode(' ', $query);
foreach ($parts as $part) {
$search = sprintf('%%%s%%', $part);
- $dbQuery->where('title', 'LIKE', $search);
+ $dbQuery->whereLike('title', $search);
}
}
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php
index 3196ca3379..99d19353a9 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepository.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php
@@ -343,7 +343,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
{
$search = $this->user->piggyBanks();
if ('' !== $query) {
- $search->where('piggy_banks.name', 'LIKE', sprintf('%%%s%%', $query));
+ $search->whereLike('piggy_banks.name', sprintf('%%%s%%', $query));
}
$search->orderBy('piggy_banks.order', 'ASC')
->orderBy('piggy_banks.name', 'ASC')
diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php
index e48456df47..a607a57e79 100644
--- a/app/Repositories/Recurring/RecurringRepository.php
+++ b/app/Repositories/Recurring/RecurringRepository.php
@@ -496,7 +496,7 @@ class RecurringRepository implements RecurringRepositoryInterface
{
$search = $this->user->recurrences();
if ('' !== $query) {
- $search->where('recurrences.title', 'LIKE', sprintf('%%%s%%', $query));
+ $search->whereLike('recurrences.title', sprintf('%%%s%%', $query));
}
$search
->orderBy('recurrences.title', 'ASC')
diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php
index 3aba0f8ebd..16b6e46822 100644
--- a/app/Repositories/Rule/RuleRepository.php
+++ b/app/Repositories/Rule/RuleRepository.php
@@ -213,7 +213,7 @@ class RuleRepository implements RuleRepositoryInterface
{
$search = $this->user->rules();
if ('' !== $query) {
- $search->where('rules.title', 'LIKE', sprintf('%%%s%%', $query));
+ $search->whereLike('rules.title', sprintf('%%%s%%', $query));
}
$search->orderBy('rules.order', 'ASC')
->orderBy('rules.title', 'ASC')
diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php
index dcfc689bfd..84d485c651 100644
--- a/app/Repositories/RuleGroup/RuleGroupRepository.php
+++ b/app/Repositories/RuleGroup/RuleGroupRepository.php
@@ -371,7 +371,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
{
$search = $this->user->ruleGroups();
if ('' !== $query) {
- $search->where('rule_groups.title', 'LIKE', sprintf('%%%s%%', $query));
+ $search->whereLike('rule_groups.title', sprintf('%%%s%%', $query));
}
$search->orderBy('rule_groups.order', 'ASC')
->orderBy('rule_groups.title', 'ASC')
diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php
index 052487081d..756ca3d738 100644
--- a/app/Repositories/Tag/TagRepository.php
+++ b/app/Repositories/Tag/TagRepository.php
@@ -205,7 +205,7 @@ class TagRepository implements TagRepositoryInterface
{
$search = sprintf('%%%s%%', $query);
- return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
+ return $this->user->tags()->whereLike('tag', $search)->get(['tags.*']);
}
/**
@@ -217,7 +217,7 @@ class TagRepository implements TagRepositoryInterface
$tags = $this->user->tags()->orderBy('tag', 'ASC');
if ('' !== $query) {
$search = sprintf('%%%s%%', $query);
- $tags->where('tag', 'LIKE', $search);
+ $tags->whereLike('tag', $search);
}
return $tags->take($limit)->get('tags.*');
@@ -309,14 +309,14 @@ class TagRepository implements TagRepositoryInterface
{
$search = sprintf('%%%s', $query);
- return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
+ return $this->user->tags()->whereLike('tag', $search)->get(['tags.*']);
}
public function tagStartsWith(string $query): Collection
{
$search = sprintf('%s%%', $query);
- return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
+ return $this->user->tags()->whereLike('tag', $search)->get(['tags.*']);
}
public function transferredInPeriod(Tag $tag, Carbon $start, Carbon $end): array
diff --git a/app/Repositories/TransactionType/TransactionTypeRepository.php b/app/Repositories/TransactionType/TransactionTypeRepository.php
index 4e47c0cffa..f45c20b66b 100644
--- a/app/Repositories/TransactionType/TransactionTypeRepository.php
+++ b/app/Repositories/TransactionType/TransactionTypeRepository.php
@@ -62,6 +62,6 @@ class TransactionTypeRepository implements TransactionTypeRepositoryInterface
return TransactionType::get();
}
- return TransactionType::where('type', 'LIKE', sprintf('%%%s%%', $query))->take($limit)->get();
+ return TransactionType::whereLike('type', sprintf('%%%s%%', $query))->take($limit)->get();
}
}
diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php
index 1d9d526c60..5ed6de96bb 100644
--- a/app/Repositories/UserGroups/Account/AccountRepository.php
+++ b/app/Repositories/UserGroups/Account/AccountRepository.php
@@ -270,7 +270,7 @@ class AccountRepository implements AccountRepositoryInterface
$query->where('accounts.active', $value);
}
if ('name' === $column) {
- $query->where('accounts.name', 'LIKE', sprintf('%%%s%%', $value));
+ $query->whereLike('accounts.name', sprintf('%%%s%%', $value));
}
}
@@ -315,7 +315,7 @@ class AccountRepository implements AccountRepositoryInterface
$parts = explode(' ', $line);
foreach ($parts as $part) {
$search = sprintf('%%%s%%', $part);
- $q->orWhere('name', 'LIKE', $search);
+ $q->orWhereLike('name', $search);
}
}
});
diff --git a/app/Repositories/UserGroups/Category/CategoryRepository.php b/app/Repositories/UserGroups/Category/CategoryRepository.php
index a4096c2c51..65f386ddd8 100644
--- a/app/Repositories/UserGroups/Category/CategoryRepository.php
+++ b/app/Repositories/UserGroups/Category/CategoryRepository.php
@@ -41,7 +41,7 @@ class CategoryRepository implements CategoryRepositoryInterface
$parts = explode(' ', $line);
foreach ($parts as $part) {
$search = sprintf('%%%s%%', $part);
- $q->orWhere('name', 'LIKE', $search);
+ $q->orWhereLike('name', $search);
}
}
});
diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
index 147829355a..e12a5c7b4c 100644
--- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php
+++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
@@ -320,7 +320,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
{
$query = TransactionCurrency::where('enabled', true);
if ('' !== $search) {
- $query->where('name', 'LIKE', sprintf('%%%s%%', $search));
+ $query->whereLike('name', sprintf('%%%s%%', $search));
}
return $query->take($limit)->get();
diff --git a/app/Repositories/UserGroups/Journal/JournalRepository.php b/app/Repositories/UserGroups/Journal/JournalRepository.php
index 7fdd9659bf..dc7e50d564 100644
--- a/app/Repositories/UserGroups/Journal/JournalRepository.php
+++ b/app/Repositories/UserGroups/Journal/JournalRepository.php
@@ -46,7 +46,7 @@ class JournalRepository implements JournalRepositoryInterface
$parts = explode(' ', $line);
foreach ($parts as $part) {
$search = sprintf('%%%s%%', $part);
- $q->orWhere('description', 'LIKE', $search);
+ $q->orWhereLike('description', $search);
}
}
});
diff --git a/app/Repositories/UserGroups/Tag/TagRepository.php b/app/Repositories/UserGroups/Tag/TagRepository.php
index ab54056800..81cad7d0ab 100644
--- a/app/Repositories/UserGroups/Tag/TagRepository.php
+++ b/app/Repositories/UserGroups/Tag/TagRepository.php
@@ -44,7 +44,7 @@ class TagRepository implements TagRepositoryInterface
$parts = explode(' ', $line);
foreach ($parts as $part) {
$search = sprintf('%%%s%%', $part);
- $q->orWhere('tag', 'LIKE', $search);
+ $q->orWhereLike('tag', $search);
}
}
});
diff --git a/app/Support/JsonApi/ExpandsQuery.php b/app/Support/JsonApi/ExpandsQuery.php
index 4dfb530bff..aec2d3a711 100644
--- a/app/Support/JsonApi/ExpandsQuery.php
+++ b/app/Support/JsonApi/ExpandsQuery.php
@@ -120,7 +120,7 @@ trait ExpandsQuery
Log::debug(sprintf('Add query filter "%s"', $key));
// add type to query:
foreach ($filter as $value) {
- $q->where($key, 'LIKE', sprintf('%%%s%%', $value));
+ $q->whereLike($key, sprintf('%%%s%%', $value));
}
}
}
diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php
index 1cb633303f..a5e66aea2a 100644
--- a/app/Support/Preferences.php
+++ b/app/Support/Preferences.php
@@ -151,7 +151,8 @@ class Preferences
public function beginsWith(User $user, string $search): Collection
{
- return Preference::where('user_id', $user->id)->where('name', 'LIKE', $search.'%')->get();
+ $value = sprintf('%s%%', $search);
+ return Preference::where('user_id', $user->id)->whereLike('name', $value)->get();
}
/**
diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php
index 60214a1290..a8dd1032a2 100644
--- a/app/Support/Search/AccountSearch.php
+++ b/app/Support/Search/AccountSearch.php
@@ -73,9 +73,9 @@ class AccountSearch implements GenericSearchInterface
case self::SEARCH_ALL:
$searchQuery->where(
static function (Builder $q) use ($like): void { // @phpstan-ignore-line
- $q->where('accounts.id', 'LIKE', $like);
- $q->orWhere('accounts.name', 'LIKE', $like);
- $q->orWhere('accounts.iban', 'LIKE', $like);
+ $q->whereLike('accounts.id', $like);
+ $q->orWhereLike('accounts.name', $like);
+ $q->orWhereLike('accounts.iban', $like);
}
);
// meta data:
@@ -83,7 +83,7 @@ class AccountSearch implements GenericSearchInterface
static function (Builder $q) use ($originalQuery): void { // @phpstan-ignore-line
$json = json_encode($originalQuery, JSON_THROW_ON_ERROR);
$q->where('account_meta.name', '=', 'account_number');
- $q->where('account_meta.data', 'LIKE', $json);
+ $q->whereLike('account_meta.data', $json);
}
);
@@ -95,12 +95,12 @@ class AccountSearch implements GenericSearchInterface
break;
case self::SEARCH_NAME:
- $searchQuery->where('accounts.name', 'LIKE', $like);
+ $searchQuery->whereLike('accounts.name', $like);
break;
case self::SEARCH_IBAN:
- $searchQuery->where('accounts.iban', 'LIKE', $like);
+ $searchQuery->whereLike('accounts.iban', $like);
break;