mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Search improvements.
This commit is contained in:
@@ -556,6 +556,25 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $types
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function searchAccount(string $query, array $types): Collection
|
||||
{
|
||||
$dbQuery = $this->user->accounts();
|
||||
$search = sprintf('%%%s%%', $query);
|
||||
if (\count($types) > 0) {
|
||||
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
|
||||
$dbQuery->whereIn('account_types.type', $types);
|
||||
}
|
||||
$dbQuery->where('name', 'LIKE', $search);
|
||||
|
||||
return $dbQuery->get(['accounts.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
|
Reference in New Issue
Block a user