Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

Commit

Permalink
Find where method
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidesu committed Sep 19, 2016
1 parent df7c20a commit 830963d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Repositories/EloquentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,19 @@ public function findWhere($where, $columns = ['*'], $with = [])
$cacheKey = $this->generateKey([$where, $columns, $with]);

return $this->cacheResults(get_called_class(), __FUNCTION__, $cacheKey, function() use ($where, $columns, $with) {
$model = $this->model->query();

foreach ($where as $attribute => $value) {
if (is_array($value)) {
list($attribute, $condition, $value) = $value;
$this->model->where($attribute, $condition, $value);

$model->where($attribute, $condition, $value);
} else {
$this->model->where($attribute, '=', $value);
$model->where($attribute, '=', $value);
}
}

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

0 comments on commit 830963d

Please sign in to comment.