I have user model and Language model where the language model contains different languages and i want the user to select the languages from that model and it should be stored for the corresponding user. Consider there are five languages A, B, C, D, E then the user has to select from the languages. Suppose user 1 selects A and C whereas user 2 selects B and D then the languages has to be stored for that user. How can i do this? please help me.
I have user model and Language model where the language model contains different languages
Share
You need to model a many-to-many relationship. As explained in the link, this can be done by declaring
and creating a new table called something like
language_usersto storeuser_idandlanguage_id. Each record in this table indicates that a particular user has selected a particular language.