feat: Enhance topic management and synchronization features

This commit is contained in:
2026-02-21 00:09:48 +01:00
parent b2ac61c904
commit 10ddd2ac1c
4 changed files with 116 additions and 120 deletions

View File

@@ -109,13 +109,21 @@ class SiteController extends Controller
$topics = Topic::findBySiteWithGlobal((int) $id);
$globalTopics = GlobalTopic::findAllGrouped();
$assignedGlobalIds = array_filter(array_column($topics, 'global_topic_id'));
$assignedGlobalIds = array_values(array_unique(array_map(
static fn($v) => (int) $v,
array_filter(array_column($topics, 'global_topic_id'))
)));
$assignedTopicNames = array_values(array_unique(array_filter(array_map(
static fn($name) => mb_strtolower(trim((string) $name)),
array_column($topics, 'name')
))));
$this->view('sites/edit', [
'site' => $site,
'topics' => $topics,
'globalTopics' => $globalTopics,
'assignedGlobalIds' => $assignedGlobalIds,
'assignedTopicNames' => $assignedTopicNames,
]);
}