Answer the question
In order to leave comments, you need to log in
Custom fields for Laravel models. How to design a database?
Let's say we have some models in our project: Article, news, comment, user. So, it became necessary to add custom fields to these entities (analogue of Custom fields in Bitrix). Each entity can have many and different types of fields (string, number, list, file, boolean).
What is the best way to design a database for such a case in order to make the most of Eloquent "relationships" and avoid "manual" queries?
Answer the question
In order to leave comments, you need to log in
I don’t know how Bitrix implemented this, but I think Entity–attribute–value model (EAV) will suit you .
Maybe NoSQL is better suited for such tasks? For example, try with Mongo, will it not hurt so much?
In general, such an architecture is very weak and poorly scalable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question