lundi 17 décembre 2018

Best way to define eloquent relationship with comma separated value

I am confused how should I define or design database to get best eloquent result. Sometimes I need to save comma separated value in column for simplicity. Suppose I have sub_modules and routes table where one sub_modules may have many routes. I am making sub_modules with some routes. One sub_modules may have more than 1000 routes. That's why I want to put those routes list with comma separated in sub_modules table. Current structure:: sub modules table: id---name----route_ids routes table: id---url---name

should I define one to many relations or current structure is better? If I keep current structure then how can define eloquent relationship in SubModule model class? I have some other table that will be big if I use one to many relationship using third table. Please suggest me some better solutions.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire