articleId = (int) $id; $this->loadArticle(); $this->loadRelatedArticles(); $this->loadThemeContent(); } private function loadArticle() { $articles = $this->getArticlesData(); $this->article = $articles[$this->articleId] ?? $articles[1]; } private function loadRelatedArticles() { $articles = $this->getArticlesData(); $this->relatedArticles = collect($articles) ->filter(fn($article, $key) => $key != $this->articleId) ->take(2) ->values() ->toArray(); } private function loadThemeContent() { $theme = config('app.theme', 'b2in'); $this->content = config("content.themes.{$theme}.magazin_detail", []); } private function getArticlesData() { return config('content.articles', []); } public function render() { return view('livewire.web.components.sections.magazin-detail', [ 'article' => $this->article, 'relatedArticles' => $this->relatedArticles ]); } }