topic = is_numeric($topic) ? Topic::findOrFail($topic) : $topic; Log::info('Topic loaded', [ 'topic_id' => $this->topic->id, 'topic_title' => $this->topic->title ]); } catch (\Exception $e) { Log::error('Topic loading error', [ 'error' => $e->getMessage(), 'topic' => $topic ]); session()->flash('error', 'Topic not found'); return redirect()->route('forum.index'); } } public function render() { $topic = Topic::with(['user', 'comments']) ->findOrFail($this->topic->id); return view('livewire.forum.topic-view'); } }