Changed channel categories from DB-backed Category records to a backed PHP enum

This commit is contained in:
2026-05-18 06:55:03 +03:30
parent 295a408965
commit 59e4ae60da
20 changed files with 221 additions and 130 deletions

View File

@@ -22,7 +22,7 @@ class ChannelController extends Controller
): Response {
abort_if($channel->isSuspended(), 404);
$channel->load(['category', 'liveBroadcast', 'user']);
$channel->load(['liveBroadcast', 'user']);
$channel->loadCount('follows');
$currentBroadcast = $channel->liveBroadcast;
@@ -39,11 +39,7 @@ class ChannelController extends Controller
'is_live' => $channel->is_live,
'viewer_count' => $channel->is_live ? $viewerCounts->current($channel) : 0,
'followers_count' => $channel->follows_count,
'category' => $channel->category ? [
'id' => $channel->category->id,
'name' => $channel->category->name,
'slug' => $channel->category->slug,
] : null,
'category' => $channel->category?->toOption(),
'owner' => [
'id' => $channel->user->id,
'name' => $channel->user->name,