where('module_code', $moduleCode)->first(); } /** * Обновление или создание настроек модуля * * @param string $moduleCode * @param array $data * @return bool */ public function upsert(string $moduleCode, array $data): bool { $existing = $this->getByModuleCode($moduleCode); $data['module_code'] = $moduleCode; $data['updated_at'] = date('Y-m-d H:i:s'); if ($existing) { return $this->update($existing['id'], $data); } $data['created_at'] = date('Y-m-d H:i:s'); return $this->insert($data); } /** * Получение всех активных настроек модулей * * @return array */ public function getAllActive(): array { return $this->where('is_active', 1)->findAll(); } }