Skip to content

Commit 72fc492

Browse files
author
Yoel Monzon
committed
[add] new function for paginate
1 parent 6cb3214 commit 72fc492

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Repository.php

+11
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,17 @@ public function paginate($perPage = 10, $columns = array('*'))
134134
return $this->model->paginate($perPage, $columns);
135135
}
136136

137+
/**
138+
* Return all rows paginate by value of $perPage with all relations
139+
* @param int $perPage
140+
* @param array $columns
141+
* @return mixed
142+
*/
143+
public function paginateWithAllRelations($perPage = 10, $columns = array('*'))
144+
{
145+
return $this->model->with($this->relations)->paginate($perPage, $columns);
146+
}
147+
137148
/**
138149
* Create a record of model
139150
* @param array $data

src/RepositoryInterface.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public function allWithRelations($columns = array('*'), $where);
1717

1818
public function paginate($perPage = 10, $columns = array('*'));
1919

20+
public function paginateWithAllRelations($perPage = 10, $columns = array('*'));
21+
2022
public function create(array $data);
2123

2224
public function update(array $data, $entity);

0 commit comments

Comments
 (0)