Valeri0's avatar

Separate routes to index and search

Hello friends, I used the method "index" in my controllers to get data with pagination, but paginated results are not suitable to populate a select box.

In this case I need all plain results list eventually filtered with a query param like searchable select-box.

Lately I see Laravel Nova presentation by Taylor and he made me think to use two different routes.

Do you use two separates routes ( /users, /users/search ) for this different purpose or what else?

0 likes
1 reply
jlrdw's avatar

If you have large amount for dropdown, why not just use a lookup table, or modal. An example I did a while back, just quick example:

https://onedrive.live.com/?authkey=%21AJK71sIpP45kMVA&cid=72C2FB003E9E7860&id=72C2FB003E9E7860%21118&parId=72C2FB003E9E7860%21107&o=OneUp

But modal would be fine also.

In my example I am just filling in some fields from lookup table.

But I am not positive of what you are doing in your app. But there are so many ways to Lookup or get data.

Please or to participate in this conversation.