Example #1
0
 public static function getPostByCategory($category_id)
 {
     $post_ids = \App\post_categories::where('categorie_id', '=', $category_id)->get();
     $posts = new \App\Posts();
     $ids = array();
     foreach ($post_ids as $id) {
         $ids[] = $id->post_id;
     }
     $posts = \App\Posts::whereIn('id', $ids);
     return $posts->get();
 }