'int', 'sort_order' => 'int', 'is_active' => 'bool', ]; public const TYPE_RANK = 'rank'; public const TYPE_TITLE = 'title'; // ========================================================================= // 스코프 // ========================================================================= public function scopeForTenant($query, ?int $tenantId = null) { $tenantId = $tenantId ?? session('selected_tenant_id'); if ($tenantId) { return $query->where('tenant_id', $tenantId); } return $query; } public function scopeRanks($query) { return $query->where('type', self::TYPE_RANK); } public function scopeTitles($query) { return $query->where('type', self::TYPE_TITLE); } public function scopeOrdered($query) { return $query->orderBy('sort_order'); } }