public function resourcePost($slug) { $qb = PostTranslation::with('post')->whereSlug($slug); $postTranslation = $qb->firstOrFail(); $post = $postTranslation->post()->published()->firstOrFail(); $title = $post->title; $categories = Category::with(['translations', 'postsCount'])->get(); return view('frontend.page.resources.post', ['post' => $post, 'categories' => $categories, 'title' => $title]); }
public function index() { $qb = Category::with(['translations', 'postsCount']); $categories = $qb->paginate(50); return view('admin.posts.categories.index', ['categories' => $categories]); }