Files
portal-api/app/Repositories/Payment/PaymentCachedReppository.php
2025-07-24 16:18:27 +07:00

32 lines
1.1 KiB
PHP

<?php
namespace App\Repositories\Payment;
use App\Repositories\BaseCachedRepository;
use Illuminate\Support\Facades\Cache;
class PaymentCachedReppository extends BaseCachedRepository implements PaymentReppositoryInterface {
public function __construct(
public PaymentReppository $paymentReppository
){
parent::__construct();
}
public function getModel()
{
return $this->paymentReppository->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->paymentReppository->filter($data, $relationships, $withCount, $select);
});
}
}