public function categoryPosts($id, PostCategory $category) { $categories = $category->all(); $posts = Post::where('category_id', $id)->get(); return view('site.category_posts', compact('categories', 'posts')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(PostCategory $postCategory, $id) { $post = $this->model->findOrNew($id); $categories = $postCategory->lists('name', 'id'); return view('admin.posts.edit', compact('post', 'categories')); }