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

fixed pull request

parent ee85cd22
...@@ -98,4 +98,20 @@ interface BaseRepository ...@@ -98,4 +98,20 @@ interface BaseRepository
* @return bool * @return bool
*/ */
public function clearCache(); 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 ...@@ -220,4 +220,24 @@ abstract class BaseCacheDecorator implements BaseRepository
$this->entityName $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 ...@@ -195,10 +195,10 @@ abstract class EloquentBaseRepository implements BaseRepository
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function where($field, $value, $operator=null) public function where(string $field, $value, string $operator = null)
{ {
if (null==$operator) { if ($operator === null) {
$operator='='; $operator = '=';
} else { } else {
list($value, $operator) = [$operator, $value]; 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