Guest User

Untitled

a guest
Aug 10th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. $posts = post::where('category_id', $id)->paginate(7);
  2.  
  3. public function post()
  4. {
  5. return $this->hasMany(Post::class, 'parent_id', 'category_id');
  6. }
  7.  
  8. $category = Category::where('parent_id',1)->first();
  9. $post = $category->post;
Add Comment
Please, Sign In to add comment