If we were to get posts between ids of 5 and 8 including both of these values we can use following snippet
// getting posts between post id of 5 and 8 Post::select(['id','title'])->whereBetween('id',[5,8])->get() // getting posts not between post id of 5 and 8 Post::select(['id','title'])->whereNotBetween('id',[5,8])->get()