Adding method to get all records returned as query builder

parent 9ff02cc6
...@@ -4,6 +4,7 @@ namespace Modules\Core\Repositories\Cache; ...@@ -4,6 +4,7 @@ namespace Modules\Core\Repositories\Cache;
use Illuminate\Cache\Repository; use Illuminate\Cache\Repository;
use Illuminate\Config\Repository as ConfigRepository; use Illuminate\Config\Repository as ConfigRepository;
use Illuminate\Database\Eloquent\Builder;
use Modules\Core\Repositories\BaseRepository; use Modules\Core\Repositories\BaseRepository;
abstract class BaseCacheDecorator implements BaseRepository abstract class BaseCacheDecorator implements BaseRepository
...@@ -65,6 +66,20 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -65,6 +66,20 @@ abstract class BaseCacheDecorator implements BaseRepository
); );
} }
/**
* @inheritdoc
*/
public function allWithBuilder() : Builder
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.all", $this->cacheTime,
function () {
return $this->repository->allWithBuilder();
}
);
}
/** /**
* @inheritdoc * @inheritdoc
*/ */
......
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