public function showPost($kategori, $slug) { $locale = Localization::getCurrentLocale(); $article = Post::article()->where('slug_' . $locale, '=', $slug)->firstOrFail(); $kat = Category::where('id', '!=', 1)->where('slug_' . $locale, '=', $kategori)->where('id', '=', $article->id_kategori)->firstOrFail(); return view('article.showPost', compact('kat', 'article')); }
public function showPage($slug) { $locale = Localization::getCurrentLocale(); if ($page = Post::page()->where('slug_' . $locale, '=', $slug)->first()) { return view('page.showPage', compact('page')); } else { $page = Category::where('id', '!=', 1)->where('slug_' . $locale, '=', $slug)->firstOrFail(); $daftar_artikel = Post::article()->where('id_kategori', '=', $page->id)->get(); return view('kategori.index', compact('page', 'daftar_artikel')); } }