perf(core): 대용량 목록 상한 총 건수·커서 계약 신설 및 요청당 반복 실행 비용 정리
공개 이슈 gnuboard/g7 이 지목한 병목은 "같은 일을 반복 실행한다" 축이다. 응답·행의 무게를 다룬 · 과 겹치지 않는다. 공통 계약 — 총 건수 상한과 페이지 이동 범위는 별개 결정이다. 묶으면 필요 없이 기능이 깎인다. 총 건수만 상한을 받고(파생 테이블 COUNT), "다음" 이동은 per_page + 1 실측으로 끝까지 열어 둔다. 계산이 불가능해지는 것은 마지막 페이지 번호 하나뿐이며 그 사실은 last_page: null 이 알린다. 최신순처럼 실제 컬럼으로 정렬하는 목록은 커서로 전환해 깊이와 무관하게 일정 속도로 이동한다. 관련도순은 계산값 정렬이라 커서 키로 쓸 수 없어 offset 을 유지한다. 계약의 입구는 표준 paginate 와 같은 폭이어야 한다. 관계·쿼리 빌더를 받지 못하면 그 좁은 만큼이 그대로 운영 500 이 되고, 실제로 관리자 알림 목록에서 그렇게 터졌다. 응답 조립도 컬렉션마다 손으로 하면 형태가 늘어나는 순간 없는 값을 부르거나 새 필드를 흘리므로, 형태 판정을 paginationMeta 한 곳에 모았다. 표준 paginate 응답은 필드 단위로 이전과 동일하다. 요청당 반복 비용 — 훅 구독마다 남기던 로그 400줄, 요청당 스무 번 넘던 설정 파일 재읽기, 이미 캐시된 목록의 DB 재조회를 없앴다. 권한 판정은 요청 스코프 메모를 두어 화면 요소마다 나가던 조회를 한 번으로 줄였고, 크로스 요청 캐시는 두지 않아 권한 변경이 종전처럼 다음 요청에 반영된다. 검색 질의는 활성 엔진이 만든다. 저장소가 구체 엔진을 지목하면 플러그인이 등록한 엔진은 호출될 기회 자체를 잃고 오류 없이 다른 방식으로 동작한다. 해석기를 두어 활성 엔진에 위임하고, 전문검색이 없는 DBMS 의 부분일치 폴백도 드라이버명 하드코딩 대신 선언형 config 로 옮겼다. 총 건수가 잘린 목록에서 순번을 역산하면 0 과 음수가 나온다. 지어내지 않고 null 을 돌려주며, 그 원칙을 last_page 와 동일하게 적용했다.
This commit is contained in:
1 parent
97ab99b7cd
commit
2ae1972a3b
101 files changed
+6160
-322
No files matched your search
@@ -5,10 +5,14 @@ namespace App\Repositories;
|
||||
use App\Contracts\Repositories\ActivityLogRepositoryInterface;
|
||||
use App\Helpers\PermissionHelper;
|
||||
use App\Helpers\TimezoneHelper;
|
||||
use App\Http\Resources\BaseApiCollection;
|
||||
use App\Models\ActivityLog;
|
||||
use App\Repositories\Concerns\HasMultipleSearchFilters;
|
||||
use App\Repositories\Concerns\PaginatesWithDeferredJoin;
|
||||
use App\Repositories\Concerns\ResolvesSortSpec;
|
||||
use App\Support\Query\KeysetPaginator;
|
||||
use App\Support\Query\PaginationLimits;
|
||||
use Illuminate\Contracts\Pagination\CursorPaginator;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -65,16 +69,22 @@ class ActivityLogRepository implements ActivityLogRepositoryInterface
|
||||
columns: ['*'],
|
||||
sort: [['column' => 'created_at', 'direction' => $sortOrder]],
|
||||
perPage: (int) ($filters['per_page'] ?? 15),
|
||||
// 로그 테이블은 계속 쌓이기만 한다. 총 건수는 상한까지만 세고 "다음" 이동은
|
||||
// per_page + 1 실측으로 끝까지 열어 둔다 (계산 불가는 마지막 페이지 번호 하나뿐).
|
||||
resultCap: PaginationLimits::resultCap('admin.activity_logs'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 활동 로그 목록을 페이지네이션하여 조회합니다.
|
||||
*
|
||||
* 요청에 `cursor` 가 있으면 키셋(커서) 방식으로, 없으면 페이지 번호 방식으로 응답합니다.
|
||||
* 두 방식의 응답 봉투 차이는 {@see BaseApiCollection} 이 흡수합니다.
|
||||
*
|
||||
* @param array $filters 필터 조건
|
||||
* @return LengthAwarePaginator 페이지네이션된 로그 목록
|
||||
* @return LengthAwarePaginator|CursorPaginator 페이지네이션된 로그 목록
|
||||
*/
|
||||
public function getPaginated(array $filters = []): LengthAwarePaginator
|
||||
public function getPaginated(array $filters = []): LengthAwarePaginator|CursorPaginator
|
||||
{
|
||||
// 관계는 지연 조인의 outer 에서만 로드한다 (inner 는 키 컬럼만 조회한다)
|
||||
$query = ActivityLog::query();
|
||||
@@ -122,6 +132,26 @@ class ActivityLogRepository implements ActivityLogRepositoryInterface
|
||||
}
|
||||
|
||||
$sort = $this->resolveSortSpec($filters, self::SORTABLE_COLUMNS, 'created_at');
|
||||
$perPage = (int) ($filters['per_page'] ?? 15);
|
||||
|
||||
// 커서를 받은 요청은 키셋으로 응답한다. 로그는 계속 쌓이기만 해서 깊은 페이지를
|
||||
// OFFSET 으로 훑으면 건너뛸 행을 실제로 읽어야 하지만, 커서는 직전 페이지의 정렬
|
||||
// 키를 WHERE 경계로 삼아 깊이와 무관하게 일정하다.
|
||||
// 커서 모드에서는 OFFSET 자체가 없으므로 지연 조인이 해결하려던 문제도 함께 사라진다.
|
||||
$sortKeys = array_map(
|
||||
static fn (array $spec): array => [$spec['column'], $spec['direction']],
|
||||
$sort
|
||||
);
|
||||
|
||||
if (! empty($filters['cursor']) && KeysetPaginator::supports($sortKeys, self::SORTABLE_COLUMNS)) {
|
||||
return KeysetPaginator::paginate(
|
||||
query: $query->with('user:id,uuid,name,email'),
|
||||
perPage: $perPage,
|
||||
sortKeys: $sortKeys,
|
||||
uniqueKey: 'id',
|
||||
cursor: (string) $filters['cursor'],
|
||||
);
|
||||
}
|
||||
|
||||
// 목록 컬럼을 좁히지 않는 이유: 활동 로그 리소스는 변경 내역(mediumText `changes`)과
|
||||
// 부가 정보(`properties`)까지 그대로 노출하므로 컬럼을 빼면 응답 계약이 바뀐다.
|
||||
@@ -130,8 +160,11 @@ class ActivityLogRepository implements ActivityLogRepositoryInterface
|
||||
query: $query,
|
||||
columns: ['*'],
|
||||
sort: $sort,
|
||||
perPage: (int) ($filters['per_page'] ?? 15),
|
||||
perPage: $perPage,
|
||||
relations: ['user:id,uuid,name,email'],
|
||||
// 로그 테이블은 계속 쌓이기만 한다. 총 건수는 상한까지만 세고 "다음" 이동은
|
||||
// per_page + 1 실측으로 끝까지 열어 둔다 (계산 불가는 마지막 페이지 번호 하나뿐).
|
||||
resultCap: PaginationLimits::resultCap('admin.activity_logs'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Concerns;
|
||||
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* 날짜 필터를 인덱스가 살아 있는 범위 조건으로 적용하는 Trait
|
||||
*
|
||||
* `whereDate('created_at', ...)` 는 컬럼에 `DATE()` 를 씌운다. 함수가 씌워진 컬럼은
|
||||
* 인덱스를 탈 수 없으므로, 그 조건 하나 때문에 목록 전체가 풀스캔이 된다. 같은 결과를
|
||||
* 내는 `>= 하루 시작` / `<= 하루 끝` 범위 조건으로 바꾸면 인덱스가 그대로 쓰인다.
|
||||
*
|
||||
* 경계 처리를 각 저장소가 따로 적으면 한쪽이 종료일 하루를 통째로 빠뜨리기 쉽다
|
||||
* (`<= '2026-08-02'` 는 그날 00:00:00 까지만 포함한다). 경계는 이 Trait 한 곳에서만 정한다.
|
||||
*/
|
||||
trait FiltersByDateRange
|
||||
{
|
||||
/**
|
||||
* 기간(시작일~종료일) 필터를 범위 조건으로 적용합니다.
|
||||
*
|
||||
* 종료일은 그날 23:59:59.999999 까지 포함하므로 `whereDate(..., '<=', ...)` 와
|
||||
* 같은 결과를 냅니다.
|
||||
*
|
||||
* @param Builder|\Illuminate\Database\Query\Builder $query 대상 쿼리
|
||||
* @param string $column 날짜 컬럼 (테이블 한정자 포함 가능)
|
||||
* @param string|null $startDate 시작일 (빈 값이면 미적용)
|
||||
* @param string|null $endDate 종료일 (빈 값이면 미적용)
|
||||
*/
|
||||
protected function applyDateRangeFilter($query, string $column, ?string $startDate, ?string $endDate): void
|
||||
{
|
||||
if (! empty($startDate)) {
|
||||
$query->where($column, '>=', CarbonImmutable::parse($startDate)->startOfDay());
|
||||
}
|
||||
|
||||
if (! empty($endDate)) {
|
||||
$query->where($column, '<=', CarbonImmutable::parse($endDate)->endOfDay());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 하루에 해당하는 행만 남기는 필터를 범위 조건으로 적용합니다.
|
||||
*
|
||||
* @param Builder|\Illuminate\Database\Query\Builder $query 대상 쿼리
|
||||
* @param string $column 날짜 컬럼 (테이블 한정자 포함 가능)
|
||||
* @param \DateTimeInterface|string $day 대상 날짜
|
||||
*/
|
||||
protected function applyDayFilter($query, string $column, \DateTimeInterface|string $day): void
|
||||
{
|
||||
$target = CarbonImmutable::parse($day instanceof \DateTimeInterface ? $day->format('Y-m-d H:i:s') : $day);
|
||||
|
||||
$query->whereBetween($column, [$target->startOfDay(), $target->endOfDay()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 연·월에 해당하는 행만 남기는 필터를 범위 조건으로 적용합니다.
|
||||
*
|
||||
* `whereYear` + `whereMonth` 조합은 컬럼에 함수를 두 번 씌워 인덱스를 완전히 막습니다.
|
||||
*
|
||||
* @param Builder|\Illuminate\Database\Query\Builder $query 대상 쿼리
|
||||
* @param string $column 날짜 컬럼 (테이블 한정자 포함 가능)
|
||||
* @param int $year 연도
|
||||
* @param int $month 월 (1~12)
|
||||
*/
|
||||
protected function applyMonthFilter($query, string $column, int $year, int $month): void
|
||||
{
|
||||
$start = CarbonImmutable::create($year, $month, 1)->startOfDay();
|
||||
|
||||
$query->whereBetween($column, [$start, $start->endOfMonth()]);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,14 @@
|
||||
|
||||
namespace App\Repositories\Concerns;
|
||||
|
||||
use App\Enums\TotalRelation;
|
||||
use App\Support\Query\BoundedPage;
|
||||
use App\Support\Query\BoundedPaginator;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Database\Query\Expression;
|
||||
use Illuminate\Contracts\Pagination\Paginator as PaginatorContract;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Pagination\Paginator;
|
||||
@@ -66,10 +70,11 @@ trait PaginatesWithDeferredJoin
|
||||
* @param bool $preserveIdOrder true = inner 가 정한 ID 순서를 outer 에서 그대로 복원
|
||||
* @param string $pageName 페이지 쿼리 파라미터명
|
||||
* @param Closure|null $outerUsing outer 에만 적용할 조인/집계 (inner 에서는 실행되지 않는다)
|
||||
* @return PaginatorContract 페이지네이터 ($simple=true 면 Paginator, 아니면 LengthAwarePaginator)
|
||||
* @param int|null $resultCap 총 건수 집계 상한 (null = 항상 정확한 COUNT)
|
||||
* @return PaginatorContract 페이지네이터 ($simple=true 면 Paginator, $resultCap 지정 시 BoundedPage, 아니면 LengthAwarePaginator)
|
||||
*/
|
||||
protected function paginateWithDeferredJoin(
|
||||
Builder $query,
|
||||
Builder|Relation $query,
|
||||
array $columns,
|
||||
array $sort,
|
||||
int $perPage,
|
||||
@@ -82,7 +87,14 @@ trait PaginatesWithDeferredJoin
|
||||
bool $preserveIdOrder = false,
|
||||
string $pageName = 'page',
|
||||
?Closure $outerUsing = null,
|
||||
?int $resultCap = null,
|
||||
): PaginatorContract {
|
||||
// 관계(`$model->items()`)도 받는다 — 표준 `paginate()` 가 되는 자리는 이 계약으로
|
||||
// 바꿔도 되어야 한다. 관계의 소속 조건은 그 밑 빌더에 이미 들어가 있어 보존된다.
|
||||
// (쿼리 빌더는 받지 않는다. 이 계약은 모델의 키 컬럼·eager load 를 다루므로
|
||||
// Eloquent 가 전제다 — 넓힐 수 있는 범위와 없는 범위를 구분한다.)
|
||||
$query = $query instanceof Relation ? $query->getQuery() : $query;
|
||||
|
||||
$page = $page ?: Paginator::resolveCurrentPage($pageName);
|
||||
$page = max(1, $page);
|
||||
|
||||
@@ -94,7 +106,16 @@ trait PaginatesWithDeferredJoin
|
||||
// whereHas 는 결과 집합을 결정하는 조건이라 setEagerLoads 로 지워지지 않는다 (의도된 구분).
|
||||
$inner = (clone $query)->setEagerLoads([]);
|
||||
|
||||
if (! $simple && $total === null) {
|
||||
// 상한이 지정되면 총 건수를 상한까지만 센다. 다음 페이지 판정은 총 건수와 무관하게
|
||||
// per_page + 1 실측으로 하므로, 마지막 페이지 번호 하나만 계산 불가가 된다.
|
||||
$bounded = ! $simple && $resultCap !== null && $resultCap > 0;
|
||||
$relation = null;
|
||||
|
||||
if ($bounded && $total === null) {
|
||||
// Eloquent 빌더를 그대로 넘긴다 — countWithCap 이 내부에서 toBase() 로
|
||||
// 글로벌 스코프까지 적용한 기반 쿼리를 만든다.
|
||||
[$total, $relation] = BoundedPaginator::countWithCap(clone $inner, $resultCap);
|
||||
} elseif (! $simple && $total === null) {
|
||||
// Laravel 의 paginate() 와 같은 집계 경로를 쓴다. count() 는 groupBy/having 이 있는
|
||||
// 쿼리에서 `select count(*) ... group by ...` 를 그대로 실행해 **첫 그룹의 행 수**를
|
||||
// 총 건수로 돌려준다. getCountForPagination() 은 그룹 쿼리를 서브쿼리로 감싸므로
|
||||
@@ -105,10 +126,11 @@ trait PaginatesWithDeferredJoin
|
||||
|
||||
$this->applySortSpec($inner, $sort);
|
||||
|
||||
// simple 모드는 다음 페이지 유무 판정을 위해 한 건을 더 읽는다 (Paginator 가 잘라낸다).
|
||||
// simple/bounded 모드는 다음 페이지 유무 판정을 위해 한 건을 더 읽는다.
|
||||
// forPage() 를 쓰면 offset 이 (page-1) * (perPage+1) 로 계산돼 페이지가 넘어갈수록
|
||||
// 건너뛰는 행이 어긋나므로, offset 은 perPage 기준으로 직접 지정한다.
|
||||
$fetchCount = $simple ? $perPage + 1 : $perPage;
|
||||
$probesNextPage = $simple || $bounded;
|
||||
$fetchCount = $probesNextPage ? $perPage + 1 : $perPage;
|
||||
|
||||
$ids = $inner
|
||||
->select($inner->getModel()->qualifyColumn($keyName))
|
||||
@@ -116,6 +138,12 @@ trait PaginatesWithDeferredJoin
|
||||
->limit($fetchCount)
|
||||
->pluck($keyName);
|
||||
|
||||
$hasMorePages = $probesNextPage && $ids->count() > $perPage;
|
||||
|
||||
if ($bounded && $hasMorePages) {
|
||||
$ids = $ids->slice(0, $perPage)->values();
|
||||
}
|
||||
|
||||
$items = $ids->isEmpty()
|
||||
? new Collection
|
||||
: $this->fetchDeferredJoinRows($query, $columns, $sort, $ids->all(), $relations, $withCount, $keyName, $preserveIdOrder, $outerUsing);
|
||||
@@ -129,6 +157,22 @@ trait PaginatesWithDeferredJoin
|
||||
return new Paginator($items, $perPage, $page, $options);
|
||||
}
|
||||
|
||||
if ($bounded) {
|
||||
// 동시 삽입으로 집계 시점과 조회 시점의 모수가 달라질 수 있다
|
||||
$seenSoFar = ($page - 1) * $perPage + $items->count();
|
||||
|
||||
return new BoundedPage(
|
||||
items: $items,
|
||||
total: max((int) $total, $seenSoFar),
|
||||
perPage: $perPage,
|
||||
currentPage: $page,
|
||||
totalRelation: $relation ?? TotalRelation::Exact,
|
||||
resultCap: $resultCap,
|
||||
hasMorePages: $hasMorePages,
|
||||
options: $options,
|
||||
);
|
||||
}
|
||||
|
||||
return new LengthAwarePaginator($items, $total ?? $items->count(), $perPage, $page, $options);
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +263,7 @@ class IdentityPolicyRepository implements IdentityPolicyRepositoryInterface
|
||||
*/
|
||||
public function allEnabled(): Collection
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 본인인증 정책은 운영자가 등록한 수만큼만 존재한다 (사용량과 무관)
|
||||
return IdentityPolicy::query()->where('enabled', true)->get();
|
||||
}
|
||||
|
||||
@@ -347,6 +348,7 @@ class IdentityPolicyRepository implements IdentityPolicyRepositoryInterface
|
||||
return [];
|
||||
}
|
||||
|
||||
// audit:allow query-unbounded-get reason: 본인인증 정책은 운영자가 등록한 수만큼만 존재한다 (사용량과 무관)
|
||||
return IdentityPolicy::query()
|
||||
->where('scope', 'hook')
|
||||
->distinct()
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Helpers\TimezoneHelper;
|
||||
use App\Models\IdentityPolicy;
|
||||
use App\Models\IdentityVerificationLog;
|
||||
use App\Repositories\Concerns\PaginatesWithDeferredJoin;
|
||||
use App\Support\Query\PaginationLimits;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
@@ -219,6 +220,9 @@ class IdentityVerificationLogRepository implements IdentityVerificationLogReposi
|
||||
columns: ['*'],
|
||||
sort: [['column' => $sortBy, 'direction' => $sortOrder]],
|
||||
perPage: $perPage,
|
||||
// 로그 테이블은 계속 쌓이기만 한다. 총 건수는 상한까지만 세고 "다음" 이동은
|
||||
// per_page + 1 실측으로 끝까지 열어 둔다 (계산 불가는 마지막 페이지 번호 하나뿐).
|
||||
resultCap: PaginationLimits::resultCap('admin.identity_logs'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,17 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
*/
|
||||
private ?array $cache = null;
|
||||
|
||||
/**
|
||||
* 카테고리별 메모리 캐시
|
||||
*
|
||||
* 부팅 한 번에 같은 카테고리를 여러 곳에서 읽는다 — SettingsServiceProvider 의
|
||||
* apply*Config 9종과 loadCoreSettingsToConfig 가 각각 조회하므로, 캐시가 없으면
|
||||
* 요청마다 카테고리 수만큼 곱한 횟수로 파일 존재 확인·읽기·JSON 파싱이 반복된다.
|
||||
*
|
||||
* @var array<string, array<string, mixed>>
|
||||
*/
|
||||
private array $categoryCache = [];
|
||||
|
||||
/**
|
||||
* 모든 카테고리의 설정을 조회합니다.
|
||||
*
|
||||
@@ -67,9 +78,27 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
/**
|
||||
* 특정 카테고리의 설정을 조회합니다.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
* @param string $category 카테고리명
|
||||
* @return array<string, mixed> 기본값과 병합된 설정
|
||||
*/
|
||||
public function getCategory(string $category): array
|
||||
{
|
||||
if (array_key_exists($category, $this->categoryCache)) {
|
||||
return $this->categoryCache[$category];
|
||||
}
|
||||
|
||||
return $this->categoryCache[$category] = $this->readCategory($category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 카테고리 설정을 파일에서 읽어 기본값과 병합합니다.
|
||||
*
|
||||
* 캐시를 거치지 않는 실제 읽기 경로입니다.
|
||||
*
|
||||
* @param string $category 카테고리명
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function readCategory(string $category): array
|
||||
{
|
||||
if (! $this->categoryExists($category)) {
|
||||
return $this->getDefaultsForCategory($category);
|
||||
@@ -77,11 +106,17 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
|
||||
$path = $this->getCategoryPath($category);
|
||||
|
||||
// audit:allow no-storage-disk-direct reason: 이 저장소는 SettingsServiceProvider::register() 에서
|
||||
// `new` 로 직접 생성된다 — 컨테이너 바인딩 이전이라 StorageInterface 를 해석할 수 없다.
|
||||
// 설정 JSON 은 부팅 자체가 의존하는 자료라 드라이버 추상화보다 부팅 순서가 우선한다.
|
||||
if (! Storage::disk(self::STORAGE_DISK)->exists($path)) {
|
||||
return $this->getDefaultsForCategory($category);
|
||||
}
|
||||
|
||||
try {
|
||||
// audit:allow no-storage-disk-direct reason: 이 저장소는 SettingsServiceProvider::register() 에서
|
||||
// `new` 로 직접 생성된다 — 컨테이너 바인딩 이전이라 StorageInterface 를 해석할 수 없다.
|
||||
// 설정 JSON 은 부팅 자체가 의존하는 자료라 드라이버 추상화보다 부팅 순서가 우선한다.
|
||||
$content = Storage::disk(self::STORAGE_DISK)->get($path);
|
||||
$data = json_decode($content, true);
|
||||
|
||||
@@ -113,6 +148,8 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
* 도트 노테이션으로 특정 설정값을 조회합니다.
|
||||
*
|
||||
* @param string $key 예: 'mail.host', 'general.site_name'
|
||||
* @param mixed $default 값이 없을 때 돌려줄 기본값
|
||||
* @return mixed 설정값 (없으면 $default)
|
||||
*/
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
@@ -131,6 +168,10 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
|
||||
/**
|
||||
* 도트 노테이션으로 특정 설정값을 저장합니다.
|
||||
*
|
||||
* @param string $key 설정 키 (카테고리.항목)
|
||||
* @param mixed $value 저장할 값
|
||||
* @return bool 저장 성공 여부
|
||||
*/
|
||||
public function set(string $key, mixed $value): bool
|
||||
{
|
||||
@@ -150,7 +191,8 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
/**
|
||||
* 여러 설정을 일괄 저장합니다.
|
||||
*
|
||||
* @param array<string, mixed> $settings
|
||||
* @param array<string, mixed> $settings 도트 노테이션 키 ⇒ 값
|
||||
* @return bool 저장 성공 여부
|
||||
*/
|
||||
public function setMany(array $settings): bool
|
||||
{
|
||||
@@ -171,7 +213,9 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
/**
|
||||
* 특정 카테고리의 설정을 저장합니다.
|
||||
*
|
||||
* @param array<string, mixed> $settings
|
||||
* @param string $category 카테고리명
|
||||
* @param array<string, mixed> $settings 저장할 설정
|
||||
* @return bool 저장 성공 여부
|
||||
*/
|
||||
public function saveCategory(string $category, array $settings): bool
|
||||
{
|
||||
@@ -195,6 +239,9 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
|
||||
try {
|
||||
// 파일 잠금으로 동시 쓰기 방지
|
||||
// audit:allow no-storage-disk-direct reason: 이 저장소는 SettingsServiceProvider::register() 에서
|
||||
// `new` 로 직접 생성된다 — 컨테이너 바인딩 이전이라 StorageInterface 를 해석할 수 없다.
|
||||
// 설정 JSON 은 부팅 자체가 의존하는 자료라 드라이버 추상화보다 부팅 순서가 우선한다.
|
||||
$fullPath = Storage::disk(self::STORAGE_DISK)->path($path);
|
||||
$handle = fopen($fullPath, 'c');
|
||||
|
||||
@@ -211,8 +258,10 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
|
||||
fclose($handle);
|
||||
|
||||
// 캐시 무효화
|
||||
// 캐시 무효화 — 저장한 카테고리와 전체 맵 양쪽을 비운다.
|
||||
// 한쪽만 비우면 저장 직후 조회가 이전 값을 돌려준다.
|
||||
$this->cache = null;
|
||||
unset($this->categoryCache[$category]);
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@@ -226,6 +275,9 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
|
||||
/**
|
||||
* 설정 키 존재 여부를 확인합니다.
|
||||
*
|
||||
* @param string $key 설정 키 (카테고리.항목)
|
||||
* @return bool 존재 여부
|
||||
*/
|
||||
public function has(string $key): bool
|
||||
{
|
||||
@@ -234,6 +286,9 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
|
||||
/**
|
||||
* 특정 설정을 삭제합니다.
|
||||
*
|
||||
* @param string $key 설정 키 (카테고리.항목)
|
||||
* @return bool 삭제 성공 여부
|
||||
*/
|
||||
public function delete(string $key): bool
|
||||
{
|
||||
@@ -269,6 +324,9 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
|
||||
/**
|
||||
* 카테고리 존재 여부를 확인합니다.
|
||||
*
|
||||
* @param string $category 카테고리명
|
||||
* @return bool 존재 여부
|
||||
*/
|
||||
public function categoryExists(string $category): bool
|
||||
{
|
||||
@@ -278,7 +336,8 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
/**
|
||||
* 설정 파일을 초기화합니다.
|
||||
*
|
||||
* @param array<string, array<string, mixed>> $settings
|
||||
* @param array<string, array<string, mixed>> $settings 기본값 위에 덮어쓸 설정
|
||||
* @return bool 초기화 성공 여부
|
||||
*/
|
||||
public function initialize(array $settings = []): bool
|
||||
{
|
||||
@@ -310,6 +369,9 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
$backupPath = self::BACKUP_DIR.'/'.$backupName;
|
||||
|
||||
$zip = new \ZipArchive;
|
||||
// audit:allow no-storage-disk-direct reason: 이 저장소는 SettingsServiceProvider::register() 에서
|
||||
// `new` 로 직접 생성된다 — 컨테이너 바인딩 이전이라 StorageInterface 를 해석할 수 없다.
|
||||
// 설정 JSON 은 부팅 자체가 의존하는 자료라 드라이버 추상화보다 부팅 순서가 우선한다.
|
||||
$fullBackupPath = Storage::disk(self::STORAGE_DISK)->path($backupPath);
|
||||
|
||||
if ($zip->open($fullBackupPath, \ZipArchive::CREATE | \ZipArchive::OVERWRITE) !== true) {
|
||||
@@ -318,6 +380,9 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
|
||||
foreach ($this->getCategories() as $category) {
|
||||
$categoryPath = $this->getCategoryPath($category);
|
||||
// audit:allow no-storage-disk-direct reason: 이 저장소는 SettingsServiceProvider::register() 에서
|
||||
// `new` 로 직접 생성된다 — 컨테이너 바인딩 이전이라 StorageInterface 를 해석할 수 없다.
|
||||
// 설정 JSON 은 부팅 자체가 의존하는 자료라 드라이버 추상화보다 부팅 순서가 우선한다.
|
||||
$fullCategoryPath = Storage::disk(self::STORAGE_DISK)->path($categoryPath);
|
||||
|
||||
if (file_exists($fullCategoryPath)) {
|
||||
@@ -332,9 +397,15 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
|
||||
/**
|
||||
* 백업에서 설정을 복원합니다.
|
||||
*
|
||||
* @param string $backupPath 백업 파일 경로 (disk 기준)
|
||||
* @return bool 복원 성공 여부
|
||||
*/
|
||||
public function restore(string $backupPath): bool
|
||||
{
|
||||
// audit:allow no-storage-disk-direct reason: 이 저장소는 SettingsServiceProvider::register() 에서
|
||||
// `new` 로 직접 생성된다 — 컨테이너 바인딩 이전이라 StorageInterface 를 해석할 수 없다.
|
||||
// 설정 JSON 은 부팅 자체가 의존하는 자료라 드라이버 추상화보다 부팅 순서가 우선한다.
|
||||
$fullBackupPath = Storage::disk(self::STORAGE_DISK)->path($backupPath);
|
||||
|
||||
if (! file_exists($fullBackupPath)) {
|
||||
@@ -356,12 +427,16 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
if ($this->categoryExists($category)) {
|
||||
$content = $zip->getFromIndex($i);
|
||||
$categoryPath = $this->getCategoryPath($category);
|
||||
// audit:allow no-storage-disk-direct reason: 이 저장소는 SettingsServiceProvider::register() 에서
|
||||
// `new` 로 직접 생성된다 — 컨테이너 바인딩 이전이라 StorageInterface 를 해석할 수 없다.
|
||||
// 설정 JSON 은 부팅 자체가 의존하는 자료라 드라이버 추상화보다 부팅 순서가 우선한다.
|
||||
Storage::disk(self::STORAGE_DISK)->put($categoryPath, $content);
|
||||
}
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
$this->cache = null;
|
||||
$this->categoryCache = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -457,6 +532,9 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
*/
|
||||
private function ensureDirectoryExists(): void
|
||||
{
|
||||
// audit:allow no-storage-disk-direct reason: 이 저장소는 SettingsServiceProvider::register() 에서
|
||||
// `new` 로 직접 생성된다 — 컨테이너 바인딩 이전이라 StorageInterface 를 해석할 수 없다.
|
||||
// 설정 JSON 은 부팅 자체가 의존하는 자료라 드라이버 추상화보다 부팅 순서가 우선한다.
|
||||
$disk = Storage::disk(self::STORAGE_DISK);
|
||||
|
||||
if (! $disk->exists('.')) {
|
||||
@@ -469,6 +547,9 @@ class JsonConfigRepository implements ConfigRepositoryInterface
|
||||
*/
|
||||
private function ensureBackupDirectoryExists(): void
|
||||
{
|
||||
// audit:allow no-storage-disk-direct reason: 이 저장소는 SettingsServiceProvider::register() 에서
|
||||
// `new` 로 직접 생성된다 — 컨테이너 바인딩 이전이라 StorageInterface 를 해석할 수 없다.
|
||||
// 설정 JSON 은 부팅 자체가 의존하는 자료라 드라이버 추상화보다 부팅 순서가 우선한다.
|
||||
$disk = Storage::disk(self::STORAGE_DISK);
|
||||
|
||||
if (! $disk->exists(self::BACKUP_DIR)) {
|
||||
|
||||
@@ -50,6 +50,7 @@ class LanguagePackRepository implements LanguagePackRepositoryInterface
|
||||
*/
|
||||
public function getActivePacks(): Collection
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 언어팩은 설치된 팩 × 로케일 수만큼만 존재한다 (사용량과 무관)
|
||||
return LanguagePack::query()
|
||||
->where('status', LanguagePackStatus::Active->value)
|
||||
->get();
|
||||
@@ -96,6 +97,7 @@ class LanguagePackRepository implements LanguagePackRepositoryInterface
|
||||
?string $targetIdentifier,
|
||||
string $locale
|
||||
): Collection {
|
||||
// audit:allow query-unbounded-get reason: 언어팩은 설치된 팩 × 로케일 수만큼만 존재한다 (사용량과 무관)
|
||||
return LanguagePack::query()
|
||||
->where('scope', $scope)
|
||||
->where('target_identifier', $targetIdentifier)
|
||||
@@ -112,6 +114,7 @@ class LanguagePackRepository implements LanguagePackRepositoryInterface
|
||||
*/
|
||||
public function getActiveCoreLocales(): array
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 언어팩은 설치된 팩 × 로케일 수만큼만 존재한다 (사용량과 무관)
|
||||
return LanguagePack::query()
|
||||
->where('scope', LanguagePackScope::Core->value)
|
||||
->where('status', LanguagePackStatus::Active->value)
|
||||
@@ -246,6 +249,7 @@ class LanguagePackRepository implements LanguagePackRepositoryInterface
|
||||
*/
|
||||
public function getPacksForTarget(string $scope, string $targetIdentifier): Collection
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 언어팩은 설치된 팩 × 로케일 수만큼만 존재한다 (사용량과 무관)
|
||||
return LanguagePack::query()
|
||||
->where('scope', $scope)
|
||||
->where('target_identifier', $targetIdentifier)
|
||||
@@ -260,6 +264,7 @@ class LanguagePackRepository implements LanguagePackRepositoryInterface
|
||||
*/
|
||||
public function getPacksForLocale(string $locale): Collection
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 언어팩은 설치된 팩 × 로케일 수만큼만 존재한다 (사용량과 무관)
|
||||
return LanguagePack::query()->where('locale', $locale)->get();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,11 @@ use App\Models\NotificationLog;
|
||||
use App\Models\User;
|
||||
use App\Repositories\Concerns\PaginatesWithDeferredJoin;
|
||||
use App\Repositories\Concerns\ResolvesSortSpec;
|
||||
use App\Support\Query\KeysetPaginator;
|
||||
use App\Support\Query\PaginationLimits;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Pagination\CursorPaginator;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
|
||||
class NotificationLogRepository implements NotificationLogRepositoryInterface
|
||||
@@ -101,9 +104,9 @@ class NotificationLogRepository implements NotificationLogRepositoryInterface
|
||||
* @param array<string, mixed> $filters 필터 조건
|
||||
* @param int $perPage 페이지당 건수
|
||||
* @param User|null $scopeUser 스코프 적용 대상 사용자 (null이면 스코프 미적용)
|
||||
* @return LengthAwarePaginator 페이지네이션 결과
|
||||
* @return LengthAwarePaginator|CursorPaginator 페이지네이션 결과 (커서 요청 시 키셋)
|
||||
*/
|
||||
public function getPaginated(array $filters = [], int $perPage = 20, ?User $scopeUser = null): LengthAwarePaginator
|
||||
public function getPaginated(array $filters = [], int $perPage = 20, ?User $scopeUser = null): LengthAwarePaginator|CursorPaginator
|
||||
{
|
||||
// 관계는 지연 조인의 outer 에서만 로드한다 (inner 는 키 컬럼만 조회한다)
|
||||
$query = NotificationLog::query();
|
||||
@@ -152,6 +155,24 @@ class NotificationLogRepository implements NotificationLogRepositoryInterface
|
||||
|
||||
$sort = $this->resolveSortSpec($filters, self::SORTABLE_COLUMNS, 'sent_at');
|
||||
|
||||
// 커서를 받은 요청은 키셋으로 응답한다. 로그는 계속 쌓이기만 해서 깊은 페이지를
|
||||
// OFFSET 으로 훑으면 건너뛸 행을 실제로 읽어야 하지만, 커서는 직전 페이지의 정렬
|
||||
// 키를 WHERE 경계로 삼아 깊이와 무관하게 일정하다.
|
||||
$sortKeys = array_map(
|
||||
static fn (array $spec): array => [$spec['column'], $spec['direction']],
|
||||
$sort
|
||||
);
|
||||
|
||||
if (! empty($filters['cursor']) && KeysetPaginator::supports($sortKeys, self::SORTABLE_COLUMNS)) {
|
||||
return KeysetPaginator::paginate(
|
||||
query: $query->with(['senderUser', 'recipientUser']),
|
||||
perPage: $perPage,
|
||||
sortKeys: $sortKeys,
|
||||
uniqueKey: 'id',
|
||||
cursor: (string) $filters['cursor'],
|
||||
);
|
||||
}
|
||||
|
||||
// 목록 컬럼을 좁히지 않는 이유: 이 목록의 리소스는 렌더링된 본문(longText `body`)까지
|
||||
// 그대로 노출하므로 컬럼을 빼면 응답 계약이 바뀐다. 지연 조인만으로도 본문을 읽는
|
||||
// 행 수가 OFFSET 과 무관하게 이번 페이지 분량으로 고정된다.
|
||||
@@ -161,6 +182,9 @@ class NotificationLogRepository implements NotificationLogRepositoryInterface
|
||||
sort: $sort,
|
||||
perPage: $perPage,
|
||||
relations: ['senderUser', 'recipientUser'],
|
||||
// 로그 테이블은 계속 쌓이기만 한다. 총 건수는 상한까지만 세고 "다음" 이동은
|
||||
// per_page + 1 실측으로 끝까지 열어 둔다 (계산 불가는 마지막 페이지 번호 하나뿐).
|
||||
resultCap: PaginationLimits::resultCap('admin.notification_logs'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace App\Repositories;
|
||||
|
||||
use App\Contracts\Repositories\NotificationRepositoryInterface;
|
||||
use App\Models\User;
|
||||
use App\Support\Query\BoundedPaginator;
|
||||
use App\Support\Query\PaginationLimits;
|
||||
use Illuminate\Notifications\DatabaseNotification;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
|
||||
@@ -32,7 +34,14 @@ class NotificationRepository implements NotificationRepositoryInterface
|
||||
// 걷어낼 넓은 컬럼이 없다
|
||||
// 정렬 마지막의 기본키는 전순서 보장용이다 — created_at 동률에서 페이지 경계가
|
||||
// 흔들려 인접 페이지가 같은 알림을 중복 노출하고 다른 알림을 누락하는 것을 막는다.
|
||||
return $query->orderBy('created_at', 'desc')->orderBy('id', 'desc')->paginate($perPage);
|
||||
//
|
||||
// 알림함은 한 사용자에 묶이지만 시간이 지날수록 계속 쌓인다(설정성 테이블이 아니다).
|
||||
// 총 건수는 상한까지만 세고, 뒤쪽 페이지 이동은 실측으로 끝까지 열어 둔다.
|
||||
return BoundedPaginator::paginate(
|
||||
$query->orderBy('created_at', 'desc')->orderBy('id', 'desc'),
|
||||
perPage: $perPage,
|
||||
resultCap: PaginationLimits::resultCap('user.notifications'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ class RoleRepository implements RoleRepositoryInterface
|
||||
*/
|
||||
public function getAll(): Collection
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 역할은 운영자가 정의한 수만큼만 존재한다 (회원 수와 무관)
|
||||
return Role::with(['permissions'])
|
||||
->orderBy('id')
|
||||
->get();
|
||||
@@ -29,6 +30,7 @@ class RoleRepository implements RoleRepositoryInterface
|
||||
*/
|
||||
public function getActiveRoles(): Collection
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 역할은 운영자가 정의한 수만큼만 존재한다 (회원 수와 무관)
|
||||
return Role::where('is_active', true)
|
||||
->orderBy('id')
|
||||
->get();
|
||||
@@ -142,6 +144,7 @@ class RoleRepository implements RoleRepositoryInterface
|
||||
*/
|
||||
public function getByExtension(ExtensionOwnerType $extensionType, string $extensionIdentifier): Collection
|
||||
{
|
||||
// audit:allow query-unbounded-get reason: 역할은 운영자가 정의한 수만큼만 존재한다 (회원 수와 무관)
|
||||
return Role::where('extension_type', $extensionType)
|
||||
->where('extension_identifier', $extensionIdentifier)
|
||||
->get();
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Contracts\Repositories\ScheduleHistoryRepositoryInterface;
|
||||
use App\Models\ScheduleHistory;
|
||||
use App\Repositories\Concerns\PaginatesWithDeferredJoin;
|
||||
use App\Repositories\Concerns\ResolvesSortSpec;
|
||||
use App\Support\Query\PaginationLimits;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -116,6 +117,9 @@ class ScheduleHistoryRepository implements ScheduleHistoryRepositoryInterface
|
||||
sort: $sort,
|
||||
perPage: $perPage,
|
||||
relations: ['triggeredBy'],
|
||||
// 로그 테이블은 계속 쌓이기만 한다. 총 건수는 상한까지만 세고 "다음" 이동은
|
||||
// per_page + 1 실측으로 끝까지 열어 둔다 (계산 불가는 마지막 페이지 번호 하나뿐).
|
||||
resultCap: PaginationLimits::resultCap('admin.schedule_histories'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Enums\ScheduleResultStatus;
|
||||
use App\Enums\ScheduleType;
|
||||
use App\Helpers\PermissionHelper;
|
||||
use App\Models\Schedule;
|
||||
use App\Repositories\Concerns\FiltersByDateRange;
|
||||
use App\Repositories\Concerns\HasMultipleSearchFilters;
|
||||
use App\Repositories\Concerns\ResolvesSortSpec;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
@@ -16,6 +17,7 @@ use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class ScheduleRepository implements ScheduleRepositoryInterface
|
||||
{
|
||||
use FiltersByDateRange;
|
||||
use HasMultipleSearchFilters;
|
||||
use ResolvesSortSpec;
|
||||
|
||||
@@ -198,13 +200,13 @@ class ScheduleRepository implements ScheduleRepositoryInterface
|
||||
*/
|
||||
private function applyDateFilters(Builder $query, array $filters): void
|
||||
{
|
||||
if (! empty($filters['created_from'])) {
|
||||
$query->whereDate('created_at', '>=', $filters['created_from']);
|
||||
}
|
||||
|
||||
if (! empty($filters['created_to'])) {
|
||||
$query->whereDate('created_at', '<=', $filters['created_to']);
|
||||
}
|
||||
// whereDate 는 컬럼에 DATE() 를 씌워 인덱스를 무력화한다 — 범위 조건으로 준다.
|
||||
$this->applyDateRangeFilter(
|
||||
$query,
|
||||
'created_at',
|
||||
$filters['created_from'] ?? null,
|
||||
$filters['created_to'] ?? null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,9 +5,11 @@ namespace App\Repositories;
|
||||
use App\Contracts\Repositories\UserRepositoryInterface;
|
||||
use App\Helpers\PermissionHelper;
|
||||
use App\Models\User;
|
||||
use App\Repositories\Concerns\FiltersByDateRange;
|
||||
use App\Repositories\Concerns\HasMultipleSearchFilters;
|
||||
use App\Repositories\Concerns\PaginatesWithDeferredJoin;
|
||||
use App\Repositories\Concerns\ResolvesSortSpec;
|
||||
use App\Support\Query\PaginationLimits;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -16,6 +18,7 @@ use Laravel\Sanctum\PersonalAccessToken;
|
||||
|
||||
class UserRepository implements UserRepositoryInterface
|
||||
{
|
||||
use FiltersByDateRange;
|
||||
use HasMultipleSearchFilters;
|
||||
use PaginatesWithDeferredJoin;
|
||||
use ResolvesSortSpec;
|
||||
@@ -125,6 +128,8 @@ class UserRepository implements UserRepositoryInterface
|
||||
sort: $sort,
|
||||
perPage: $perPage,
|
||||
relations: ['roles'],
|
||||
// 회원 수가 커져도 목록 첫 화면 비용이 총 건수 COUNT 에 끌려가지 않도록 상한을 건다.
|
||||
resultCap: PaginationLimits::resultCap('admin.users'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -153,13 +158,13 @@ class UserRepository implements UserRepositoryInterface
|
||||
*/
|
||||
private function applyDateFilters(Builder $query, array $filters): void
|
||||
{
|
||||
if (! empty($filters['start_date'])) {
|
||||
$query->whereDate('created_at', '>=', $filters['start_date']);
|
||||
}
|
||||
|
||||
if (! empty($filters['end_date'])) {
|
||||
$query->whereDate('created_at', '<=', $filters['end_date']);
|
||||
}
|
||||
// whereDate 는 컬럼에 DATE() 를 씌워 인덱스를 무력화한다 — 범위 조건으로 준다.
|
||||
$this->applyDateRangeFilter(
|
||||
$query,
|
||||
'created_at',
|
||||
$filters['start_date'] ?? null,
|
||||
$filters['end_date'] ?? null
|
||||
);
|
||||
|
||||
// 기본 날짜 필터 (전체가 아닌 경우)
|
||||
if (empty($filters['start_date']) && empty($filters['end_date']) &&
|
||||
|
||||
Reference in new issue
Block a user