Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $posts = post::where('category_id', $id)->paginate(7);
- public function post()
- {
- return $this->hasMany(Post::class, 'parent_id', 'category_id');
- }
- $category = Category::where('parent_id',1)->first();
- $post = $category->post;
Add Comment
Please, Sign In to add comment