Skip to content

Commit

Permalink
Added support for operators in repositories parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
micheleangioni committed Jun 29, 2016
1 parent 6c9c27b commit f00f1e5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ public function countWhereHas($relation, array $where = [], array $whereHas = []

/**
* Apply the where clauses to input query.
* $where can have the format ['key' => 'value'] or ['key' => [<operator>, 'value']]
*
* @param Builder $query
* @param array $where
Expand All @@ -622,7 +623,11 @@ protected function applyWhere(Builder $query, array $where)
if (is_null($value)) {
$query = $query->whereNull($key);
} else {
$query = $query->where($key, '=', $value);
if (is_array($value)) {
$query = $query->where($key, $value[0], $value[1]);
} else {
$query = $query->where($key, '=', $value);
}
}
}

Expand Down

0 comments on commit f00f1e5

Please sign in to comment.