Y
Y
Yuri Kalnin2018-11-09 15:11:08
Laravel
Yuri Kalnin, 2018-11-09 15:11:08

How to programmatically generate tables, models and relationships between them in laravel?

For example, there is a regular online store, the Category and Product model (Categories, Products tables)
In Product - products are stored in Category are categories. Communication is admissible 1-1.
You need to make it possible to programmatically add more directories.
There is a lot of data, more than 500,000 products in each catalog. and for example, there is a directory "Building materials" and you need to add a directory "Household appliances" - each directory should have a table Categories, Products.
The bottom line is not to store all the data in one table, there are a lot of them. How is this done correctly?
How then through api to access models and use normal eloquent to work with tables?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2018-11-10
@Alex_Wells

https://laravel.com/docs/5.7/eloquent-relationships

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question