diff --git a/app/Services/ClientService.php b/app/Services/ClientService.php index 6f44428..b3af238 100644 --- a/app/Services/ClientService.php +++ b/app/Services/ClientService.php @@ -21,6 +21,7 @@ public function index(array $params) $size = (int) ($params['size'] ?? 20); $q = trim((string) ($params['q'] ?? '')); $onlyActive = $params['only_active'] ?? null; + $clientType = $params['client_type'] ?? null; $query = Client::query()->where('tenant_id', $tenantId); @@ -36,6 +37,12 @@ public function index(array $params) $query->where('is_active', (bool) $onlyActive); } + // 거래처 유형 필터 (쉼표 구분 복수 값 지원: PURCHASE,BOTH) + if ($clientType !== null && $clientType !== '') { + $types = array_map('trim', explode(',', $clientType)); + $query->whereIn('client_type', $types); + } + $query->orderBy('client_code')->orderBy('id'); $paginator = $query->paginate($size, ['*'], 'page', $page);