Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
🧮 Add count to find method.
Browse files Browse the repository at this point in the history
  • Loading branch information
rabrowne85 committed Jul 28, 2022
1 parent 9c71113 commit 6b2d1ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Interfaces/BaseRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ public function new($input);
* @param int $id ID of the record.
* @param array $columns Columns to return.
* @param array $relationships Relationships to eager load.
* @param array $counts Relationships to count.
*
* @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|Model|null
*/
public function find($id, $columns = ['*'], $relationships = []);
public function find($id, $columns = ['*'], $relationships = [], $counts = []);

/**
* Update model record for given id.
Expand Down
3 changes: 2 additions & 1 deletion src/Repositories/BaseRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,11 @@ public function new($input)
* @param int $id ID of the record.
* @param array $columns Columns to return.
* @param array $relationships Relationships to eager load.
* @param array $counts Relationships to count.
*
* @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|Model|null
*/
public function find($id, $columns = ['*'], $relationships = [])
public function find($id, $columns = ['*'], $relationships = [], $counts = [])
{
$query = $this->model->with($relationships)->newQuery();

Expand Down

0 comments on commit 6b2d1ad

Please sign in to comment.