Search improvements.

This commit is contained in:
James Cole
2019-03-02 14:12:09 +01:00
parent af07522f16
commit 87d5cabe52
16 changed files with 226 additions and 37 deletions

View File

@@ -623,6 +623,18 @@ class BillRepository implements BillRepositoryInterface
return $start;
}
/**
* @param string $query
*
* @return Collection
*/
public function searchBill(string $query): Collection
{
$query = sprintf('%%%s%%', $query);
return $this->user->bills()->where('name', 'LIKE', $query)->get();
}
/**
* @param User $user
*/

View File

@@ -33,7 +33,6 @@ use Illuminate\Support\Collection;
*/
interface BillRepositoryInterface
{
/**
* @param Bill $bill
*
@@ -236,6 +235,13 @@ interface BillRepositoryInterface
*/
public function nextExpectedMatch(Bill $bill, Carbon $date): Carbon;
/**
* @param string $query
*
* @return Collection
*/
public function searchBill(string $query): Collection;
/**
* @param User $user
*/