Skip to content

Commit 4a83a37

Browse files
author
Yoel Monzón
committed
Merge pull request #1 from Burris19/master
[add] function takeWithRelations
2 parents 72fc492 + 5c9c9e6 commit 4a83a37

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Repository.php

+9
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ public function takeByWithRelations($limit, $field, $value)
9999
{
100100
return $this->model->with($this->relations)->where($field, $value)->get()->take($limit);
101101
}
102+
/**
103+
* Return the number of rows given but filtered with relations
104+
* @param $limit
105+
* @return mixed
106+
*/
107+
public function takeWithRelations($limit)
108+
{
109+
return $this->model->with($this->relations)->get()->take($limit);
110+
}
102111

103112
/**
104113
* Return the number of random rows given but filtered the field by value given with relations only for MySQL Database

src/RepositoryInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public function takeBy($limit, $field, $value);
1111

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

14+
public function takeWithRelations($limit);
15+
1416
public function takeRandomByWithRelations($limit, $field, $value);
1517

1618
public function allWithRelations($columns = array('*'), $where);

0 commit comments

Comments
 (0)