I would like to create a pagination in Rest API for Laravel. I want pagination like, Suppose I have total 30 categories in Database & I want to display 10 items in each page So total page will be 3 and 10 items will display in each page.
I have used paginate()
method but it's only showing items by given number , I used below the script but it's not provided output that I mentioned.
$getCategories = Category::All();
$categories = DB::table('category')->paginate($pageNumber);
Does anybody tell me how could i use pagination in Rest Api?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire