S
S
StrangeGoogle2019-12-21 06:43:57
Database design
StrangeGoogle, 2019-12-21 06:43:57

How to correctly create a table and pagination?

I ask for advice and opinions from you, with a problem that I encountered. I am writing a project in Laravel. How would you implement the following?
There are brands: name (for example: bmw, mercedes, Lamborghini) and models (for example: urus, m5, s-class)
When we go to /brands/bmw we see a list of bmw models. When we look at, for example, M5, then the next one is X6 (BMW model), how would you implement such pagination? What would you use? I now count by number using PHP functions. For some reason, I decided not to use parent_id in the table. Can you please tell me how to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gian_tiaga, 2019-12-24
@StrangeGoogle

brands
- id
- name
models
- id
- name
- brand_id
- sort
In the sort field, simply indicate the numerical order, what should come after what

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question