save($customerData)) { return $customerData[$this->primaryKey] ?? $this->getInsertID(); } } catch (ReflectionException $e) { log_message('error', 'Subscription upsert failed: ' . $e->getMessage()); } return false; } public function exists(?int $customerId): bool { if (!is_int($customerId) || $customerId < 1) { return false; } $builder = $this->db->table($this->table); $builder->where('customer_id', $customerId); return ($builder->get()->getNumRows() === 1); } }