update dns

This commit is contained in:
pbao9
2026-02-04 09:07:44 +07:00
parent 0dbd9bfebe
commit 064d23d822
10 changed files with 153 additions and 164 deletions
@@ -16,19 +16,32 @@ class DnsServerCachedRepository extends BaseCachedRepository implements DnsServe
{
return $this->dnsServerRepository->getModel();
}
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
{
public function filter(
array $data = [],
array $relationships = [],
array $withCount = [],
array $select = ['*'],
bool $returnQuery = false
) {
if (
$returnQuery ||
!empty($data['paginate'])
) {
return $this->dnsServerRepository
->filter($data, $relationships, $withCount, $select, $returnQuery);
}
$cacheKey = $this->getCacheKey(md5(json_encode([
'filterItem' => [
'data' => $data,
'relationships' => $relationships,
'select' => $select,
'withCount' => $withCount
]
'filter' => compact('data', 'relationships', 'withCount', 'select')
])));
return Cache::remember($cacheKey, $this->cacheTime, function () use ($data, $relationships, $select, $withCount) {
return $this->dnsServerRepository->filter($data, $relationships, $withCount, $select);
});
return Cache::remember(
$cacheKey,
$this->cacheTime,
fn() =>
$this->dnsServerRepository
->filter($data, $relationships, $withCount, $select, $returnQuery)
);
}
public function findByName(string $name = '')
{
@@ -37,7 +50,7 @@ class DnsServerCachedRepository extends BaseCachedRepository implements DnsServe
'name' => $name
]
])));
return Cache::remember($cacheKey, $this->cacheTime, function () use ($name){
return Cache::remember($cacheKey, $this->cacheTime, function () use ($name) {
return $this->dnsServerRepository->findByName($name);
});
}