Skip to content
This repository was archived by the owner on Jan 27, 2022. It is now read-only.

Commit e0a2e9d

Browse files
committed
Add limit method to query builder
1 parent 36cc048 commit e0a2e9d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/QueryBuilder.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ public function paginate($limit = null)
104104
return new Pagination($posts);
105105
}
106106

107+
public function limit($limit)
108+
{
109+
$this->setArgument('posts_per_page', $limit);
110+
111+
return $this;
112+
}
113+
107114
protected function buildItem($post)
108115
{
109116
if ($this->model) {
@@ -211,6 +218,10 @@ protected function resolveMethodCall($method, $args)
211218
return $this->buildMetaWhere($args);
212219
}
213220

221+
if ($key == 'limit') {
222+
return $this->limit($args[0]);
223+
}
224+
214225
return $this->buildWhere($key, $value);
215226
}
216227

0 commit comments

Comments
 (0)