This commit is contained in:
James Cole
2019-11-10 07:26:49 +01:00
parent d2a8f969d9
commit f82d0dda0a
24 changed files with 96 additions and 45 deletions

View File

@@ -557,8 +557,13 @@ class AccountRepository implements AccountRepositoryInterface
->orderBy('accounts.name', 'ASC')
->with(['accountType']);
if ('' !== $query) {
$search = sprintf('%%%s%%', $query);
$dbQuery->where('name', 'LIKE', $search);
// split query on spaces just in case:
$parts = explode(' ', $query);
foreach($parts as $part) {
$search = sprintf('%%%s%%', $part);
$dbQuery->where('name', 'LIKE', $search);
}
}
if (count($types) > 0) {
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');