Laravel
Using Pagination in Laravel
18.01.2022
Pagination is a way of showing extensive data in a smaller part. Pagination in Laravel is very easy to use. It is integrated with the query builder and Eloquent ORM. Laravel pagination covers limit and offset automatically.
// app > http > controllers > PostController.php class PostController extends Controller { public function getPost(){ $posts = Post::all() ->orderBy('created_at', 'DESC') ->paginate(8); return view('index', compact('posts')); } } // index.blade.php ... <div> {{ $posts->links() }} </div>Append Parameter to Pagination
{{ $posts->appends(request()->query())->links() }}