movepixels's avatar

Laravel Pagination

Just wondering if there is a way to use the full pagination, not the SimplePagination(), but remove the first and last items in the links object where its Previous and Next

Is there i built in method? Ir simple remove it manually before sending it back to the front?

« Previous and Next »

Thanks

0 likes
7 replies
jlrdw's avatar

Also it's in the documentation you can write any pagination template you want.

1 like
movepixels's avatar

Sorry, should have mentioned laravel is backend only. I am not using blade templates or anything. I get the pagination links sent back to the front end and loop thru them, but the « Previous and Next » destroy the front end look with its includes arrows that do not render and are displayed as text / string so i would like to remove them

movepixels's avatar

@tray2 I am currently doing that. Was just wondering if there was something i might have missed in the docs where it was an option

Thanks guys!

movepixels's avatar

@jlrdw Thanks for the links

I will probably build my own Resource to include in paginates response. I dont like how Laravel has everything scattered in the data response where I would like a simple pagination => container object

current_page: 1
data: [{type: "ListingsResource", meta: [], attributes: {favorite: null,…}, relationships: []},…]
first_page_url: ""
from: 1
last_page: 8
last_page_url: ""
links: [{url: null, label: "« Previous", active: false},…]
next_page_url: ""
path: ""
per_page: 2
prev_page_url: null
to: 2
total: 15

Would be cleaner with a self made

data => [records],
pagination => [
	current_page: 1
	first_page_url: ""
	from: 1
	last_page: 8
	last_page_url: ""
	links: [{url: null, label: "« Previous", active: false},…]
	next_page_url: ""
	path: ""
	per_page: 2
	prev_page_url: null
	to: 2
	total: 15
]

Please or to participate in this conversation.