public function categoryid($id)
{
// $news = News::whereHas('categories', function ($query) use ($id) {
// $query->where('category_id', $id);
// })->where('status', '1')->where('is_publish', '1')->get();
$next = News::with(['categories' => function($query) use ($id){
$query->where('category_id', $id);
}])->where('id', '>', $id)->orderBy('id', 'asc')->get();
return json_encode($next);
}
Comments
Post a Comment