简体   繁体   中英

Many to many naming conventions

What I've understand so far is that many to many table naming conventions for Laravel are:

users & privileges = user_privilege

But what is the case with more complex names like:

attributes & composed_attributes = ?

As you can see there is a underscore symbol in the second table. Is that underscore in the way of Laravel recognizing the pivot by default? Is attribute_composed_attribute going to work? If so what is the proper name for the second table in order to work?

Appreciate your kind help.

It will be attribute_composed_attribute .

Name of the pivot table should consist of singular names of both tables, separated by undescore symbole and these names should be arranged in alphabetical order

http://laraveldaily.com/pivot-tables-and-many-to-many-relationships/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM