Example #1
0
 /**
  * return all categories that this post
  * do not belongs to.
  *
  * @return Category
  */
 public function CategoriesNotIn()
 {
     $category_ids = $this->categories->map(function ($category) {
         return $category->id;
     });
     return Category::whereNotIn('id', $category_ids)->get();
 }