I'm working on a project in Laravel for learning the framework.

我正在Laravel的一个项目中学习框架。

I create a basic register/login and after that I customize the register part. What am I planning to achieve is the point where an user can act in multiple roles.

我创建了一个基本的寄存器/登录,然后我自定义了寄存器部分。我计划实现的目标是用户可以担任多个角色。

For example: user1 can be normal user and administrator(with special access to the application) at the same time.

例如:user1可以是普通用户和管理员(具有对应用程序的特殊访问权限)。

How should I design this from database point of view ?

我应该如何从数据库的角度设计这个?

1 个解决方案

#1


2

Personally, I wouldn't create another "user" type entity for companies, but add another table for company data and connect it to a user. That way you are able to keep the default registration and login process.

就个人而言,我不会为公司创建另一个“用户”类型实体,而是为公司数据添加另一个表并将其连接到用户。这样您就可以保留默认的注册和登录过程。

If you wanted a slightly different form to register companies, I'd add another route & form to gather the "user" information as well as "company" information (company name, phone, fax, etc). Then when the registration is processed you can create the user entity, along with the company relationship with the given information.

如果您想要一个稍微不同的表格来注册公司,我会添加另一个路线和表格来收集“用户”信息以及“公司”信息(公司名称,电话,传真等)。然后,在处理注册时,您可以创建用户实体以及与给定信息的公司关系。

However, if you still wanted to create completely different entities with login/registration flows, you'd have to build your own User Providers and implement the contracts needed.

但是,如果您仍希望使用登录/注册流程创建完全不同的实体,则必须构建自己的用户提供程序并实施所需的合同。

更多相关文章

  1. Linux下修改MySQL用户(root)密码
  2. MySQL:ERROR 1227(42000):访问被拒绝 - 无法创建用户
  3. 在数据库设计中使用用户名作为主键是不是很糟糕?
  4. 为mysql数据备份建立最小权限的用户
  5. MySQL查询返回用户的收件人列表
  6. 根据用户时区显示当地时间 php+javascript
  7. Google Maps API v3:如何设置缩放级别和地图中心到用户提交的位置
  8. Ajax的实用技术——用户的注意力从页面的其他区域到转移选择的图
  9. 将特殊字符转换为HTML实体,Laravel

随机推荐

  1. Android多线程(一)
  2. Android 主题切换/换肤方案 研究(一) -
  3. ListView常用属性、方法
  4. EditView属性介绍
  5. 关于android的单位dp,dip
  6. 文字跑马灯效果
  7. Audio and Video
  8. Hello TWaver Android
  9. Android(安卓)Gesture 之触摸屏手势识别
  10. android 程序 发布加密