From 9b8cdfa2a507fbe0b655a638a94b434177b61d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Thu, 5 Mar 2026 11:01:10 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20[core]=20=EB=AA=A8=EB=8D=B8=20?= =?UTF-8?q?=EC=8A=A4=EC=BD=94=ED=94=84=20=EC=A0=81=EC=9A=A9=20=E2=80=94=20?= =?UTF-8?q?Tenant::active()=20=EC=82=AC=EC=9A=A9=20=EB=B0=8F=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EA=B7=9C=EC=B9=99=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RecordStorageUsage: where 하드코딩 → Tenant::active() 스코프 - CLAUDE.md: 쿼리 수정 시 모델 스코프 우선 규칙 명시 Co-Authored-By: Claude Opus 4.6 --- CLAUDE.md | 1 + app/Console/Commands/RecordStorageUsage.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 2b6924c..402eac7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -509,6 +509,7 @@ ### 2. Multi-tenancy & Models - SoftDeletes by default - Common columns: tenant_id, created_by, updated_by, deleted_by (COMMENT required) - FK constraints: Created during design, minimal in production +- **🔴 쿼리 수정 시 모델 스코프 우선**: `where('컬럼', '값')` 하드코딩 전에 반드시 모델에 정의된 스코프(scopeActive 등)를 먼저 확인하고, 스코프가 있으면 `Model::active()` 형태로 사용할 것 ### 3. Middleware Stack - ApiKeyMiddleware, CheckSwaggerAuth, CorsMiddleware, CheckPermission, PermMapper diff --git a/app/Console/Commands/RecordStorageUsage.php b/app/Console/Commands/RecordStorageUsage.php index 5e94bec..c77f1eb 100644 --- a/app/Console/Commands/RecordStorageUsage.php +++ b/app/Console/Commands/RecordStorageUsage.php @@ -29,7 +29,7 @@ class RecordStorageUsage extends Command */ public function handle(): int { - $tenants = Tenant::where('tenant_st_code', 'active')->get(); + $tenants = Tenant::active()->get(); $recorded = 0; foreach ($tenants as $tenant) {