Skip to content

Commit

Permalink
allow filtering with URL query params
Browse files Browse the repository at this point in the history
  • Loading branch information
mopo922 committed Oct 20, 2017
1 parent 3b10a15 commit 0911c9a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Pattern/Repository/Repository.php
Expand Up @@ -99,6 +99,14 @@ public function all(array $columns = ['*'])
{
$this->applyCriteria();

foreach (request()->query() as $key => $value) {
if (is_array($value)) {
$this->model->whereIn($key, $value);
} else {
$this->model->where($key, $value);
}
}

return $this->model->get($columns);
}

Expand Down

0 comments on commit 0911c9a

Please sign in to comment.