草庐IT

UserAccountTypeLink

全部标签

php - Laravel 5 中的链接表

我正在编写一个应用程序,它需要2个使用链接表链接在一起的表,因此总共有3个表。//-------Users//------id,name,email,password//----UserAccountType//----id,name,description//---UserAccountLink//---id,user_id,type_id,用户可以拥有多种帐户类型(管理员、普通用户、开发人员)...此外,我还设置了外键限制。唯一的问题是我不明白如何链接这些,我尝试了以下方法:classUserextendsModel{//implementationpublicfunctionac