34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Repositories\Addon;
|
|
|
|
use App\Repositories\BaseCachedRepository;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
class AddonCachedRepository extends BaseCachedRepository implements AddonRepositoryInterface
|
|
{
|
|
public function __construct(
|
|
public AddonRepository $addonRepository
|
|
) {
|
|
parent::__construct();
|
|
}
|
|
public function getModel()
|
|
{
|
|
return $this->addonRepository->getModel();
|
|
}
|
|
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
|
|
{
|
|
$cacheKey = $this->getCacheKey(md5(json_encode([
|
|
'filterItem' => [
|
|
'data' => $data,
|
|
'relationships' => $relationships,
|
|
'select' => $select,
|
|
'withCount' => $withCount
|
|
]
|
|
])));
|
|
return Cache::remember($cacheKey, $this->cacheTime, function () use ($data, $relationships, $select, $withCount) {
|
|
return $this->addonRepository->filter($data, $relationships, $withCount, $select);
|
|
});
|
|
}
|
|
}
|