I wanted to use skip
and take
but pagination does not work. Why does it not work?
Code:
$posts = DB::table('posts')
->orderBy('id','desc')
->skip(9)
->take(3)
->paginate(3);
if ($request->ajax()) {
return ['posts' => view('blog.ajax.index')->with(compact('posts'))->render(),
'next_page' => $posts->nextPageUrl()
];
}
I definitely need to use pagination