A paginator class (Illuminate\Pagination\Paginator) has a setBaseUrl method.
But i didn't tested and i dont think it can be use to transform page numbers, from query string to url segment.
With the default laravel pagination my url looks like
mydomain.com/item?page=2
Is there a way to obtain something like
mydomain.com/item/2 or mydomain.com/item/page/2
Thanks :)
A paginator class (Illuminate\Pagination\Paginator) has a setBaseUrl method.
But i didn't tested and i dont think it can be use to transform page numbers, from query string to url segment.
As long as you can pick up on those IDs at the end, because I know Route::resource() would have issues with that URI structure.
@bashy What do you mean exactly?
I need to do something similar to the episode mechanism here in Laracasts.
When I click on an episode (belonging to a serie) the url looks like
https://laracasts.com/series/SERIE_TITLE/episodes/2
Where 2 means the second episode of that serie (2 is not the id of the episode)
At first I tought to use pagination to easily have next and prev. buttons by default, but now I have to think something else.
What may I do?
Personally, I wouldn't bother changing it. What's wrong with "?page=#"? To me episodes/2 would look like episode 2
@bashy My previous post was not clear, sorry.
my goal is to implement something like episodes in laracasts. I don't need pagination. I tought to use pagination (with 1 element per page) just to have next and prev buttons out of the box! It was a trick!
Now I realized it can't work because of the url format
Is there antother way to do something similar (with or without pagination)?
Okay, I see. Why not get that from a database field in the pivot or something?
Radosław did a nice job: https://github.com/DeSmart/pagination
But you're talking about episode IDs (like a series on here), if you add one in the middle, you will have to edit the others (or make a query to update everything to the right by one).
Some ordering/sorting functions do that.
There are issues with SEO because of the ?page=
Please or to participate in this conversation.