true, 'count' => $this->repository->unreadCount(), 'items' => array_map( static fn (array $row): array => [ 'id' => (int) ($row['id'] ?? 0), 'type' => (string) ($row['type'] ?? ''), 'title' => (string) ($row['title'] ?? ''), 'body' => (string) ($row['body'] ?? ''), 'target_url' => (string) ($row['target_url'] ?? ''), 'created_at' => (string) ($row['created_at'] ?? ''), ], $this->repository->recentUnread(10) ), ]); } public function markRead(Request $request): Response { $this->repository->markRead(max(0, (int) $request->input('id', 0))); return Response::json(['ok' => true, 'count' => $this->repository->unreadCount()]); } }