Commit 146d9d94 authored by Silvio Gratani's avatar Silvio Gratani

fixed pull request

parent ee85cd22
......@@ -98,4 +98,20 @@ interface BaseRepository
* @return bool
*/
public function clearCache();
/**
* Add where statement to current builder
*
* @param string $field
* @param string|int $value
* @param string $operator
*/
public function where(string $field, $value, string $operator = null);
/**
* Eager relationship(s) loading
*
* @param array|string $relationships
*/
public function with($relationships);
}
......@@ -220,4 +220,24 @@ abstract class BaseCacheDecorator implements BaseRepository
$this->entityName
);
}
/**
* @inheritdoc
*/
public function where(string $field, $value, string $operator = null)
{
return $this->remember(function () use ($field, $value, $operator) {
return $this->repository->where($field, $value, $operator);
});
}
/**
* @inheritdoc
*/
public function with($relationships)
{
return $this->remember(function () use ($relationships) {
return $this->repository->with($relationships);
});
}
}
......@@ -195,10 +195,10 @@ abstract class EloquentBaseRepository implements BaseRepository
/**
* @inheritdoc
*/
public function where($field, $value, $operator=null)
public function where(string $field, $value, string $operator = null)
{
if (null==$operator) {
$operator='=';
if ($operator === null) {
$operator = '=';
} else {
list($value, $operator) = [$operator, $value];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment