Skip to content

Commit

Permalink
Merge pull request #308 from aejnsn/patch-1
Browse files Browse the repository at this point in the history
Add whereHas() method to RepositoryInterface contract.
  • Loading branch information
eullercdr authored Mar 10, 2017
2 parents a4329eb + 3f78494 commit efca3fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/Prettus/Repository/Contracts/RepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,17 @@ public function orderBy($column, $direction = 'asc');
* @return $this
*/
public function with($relations);


/**
* Load relation with closure
*
* @param string $relation
* @param closure $closure
*
* @return $this
*/
public function whereHas($relation, $closure);

/**
* Add subselect queries to count the relations.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Prettus/Repository/Eloquent/BaseRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ public function withCount($relations)
*
* @return $this
*/
function whereHas($relation, $closure)
public function whereHas($relation, $closure)
{
$this->model = $this->model->whereHas($relation, $closure);

Expand Down

0 comments on commit efca3fc

Please sign in to comment.