Add limit to bills. #3150

This commit is contained in:
James Cole
2020-07-21 06:22:29 +02:00
parent 62fd701808
commit 858158d886
4 changed files with 7 additions and 5 deletions

View File

@@ -661,14 +661,15 @@ class BillRepository implements BillRepositoryInterface
/**
* @param string $query
* @param int $limit
*
* @return Collection
*/
public function searchBill(string $query): Collection
public function searchBill(string $query, int $limit): Collection
{
$query = sprintf('%%%s%%', $query);
return $this->user->bills()->where('name', 'LIKE', $query)->get();
return $this->user->bills()->where('name', 'LIKE', $query)->take($limit)->get();
}
/**

View File

@@ -287,10 +287,11 @@ interface BillRepositoryInterface
/**
* @param string $query
* @param int $limit
*
* @return Collection
*/
public function searchBill(string $query): Collection;
public function searchBill(string $query, int $limit): Collection;
/**
* @param User $user