Update autocomplete code for #3150

This commit is contained in:
James Cole
2020-07-23 06:19:34 +02:00
parent 0f840ad082
commit 162e791dfd
16 changed files with 93 additions and 459 deletions

View File

@@ -414,7 +414,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
$search->where('piggy_banks.name', 'LIKE', sprintf('%%%s%%', $query));
}
$search->orderBy('piggy_banks.order', 'ASC')
->orderBy('piggy_banks.name', 'ASC')->where('piggy_banks.active', 1);
->orderBy('piggy_banks.name', 'ASC');
return $search->take($limit)->get();
}

View File

@@ -287,10 +287,11 @@ class TagRepository implements TagRepositoryInterface
* Search the users tags.
*
* @param string $query
* @param int $limit
*
* @return Collection
*/
public function searchTags(string $query): Collection
public function searchTags(string $query, int $limit): Collection
{
/** @var Collection $tags */
$tags = $this->user->tags()->orderBy('tag', 'ASC');
@@ -299,7 +300,7 @@ class TagRepository implements TagRepositoryInterface
$tags->where('tag', 'LIKE', $search);
}
return $tags->get();
return $tags->take($limit)->get('tags.*');
}
/**

View File

@@ -165,10 +165,11 @@ interface TagRepositoryInterface
* Search the users tags.
*
* @param string $query
* @param int $limit
*
* @return Collection
*/
public function searchTags(string $query): Collection;
public function searchTags(string $query, int $limit): Collection;
/**
* @param User $user