Skip to content

Commit

Permalink
Merge branch 'master' of github.com:yoelfme/ReposityLaravel
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoel Monzon committed Oct 29, 2015
2 parents cdc5464 + 4a83a37 commit 03c1c96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ public function takeByWithRelations($limit, $field, $value)
{
return $this->model->with($this->relations)->where($field, $value)->get()->take($limit);
}
/**
* Return the number of rows given but filtered with relations
* @param $limit
* @return mixed
*/
public function takeWithRelations($limit)
{
return $this->model->with($this->relations)->get()->take($limit);
}

/**
* Return the number of random rows given but filtered the field by value given with relations only for MySQL Database
Expand Down
2 changes: 2 additions & 0 deletions src/RepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public function takeBy($limit, $field, $value);

public function takeByWithRelations($limit, $field, $value);

public function takeWithRelations($limit);

public function takeRandomByWithRelations($limit, $field, $value);

public function allWithRelations($columns = array('*'));
Expand Down

0 comments on commit 03c1c96

Please sign in to comment.