Laravel中几个表之间的关系



我在网站上有三项服务以及当用户订购其中一项服务时。该订单存储在自己的表中因此,我们有三个表来存储每个服务的订单信息

table order
-id
-And shared information such as amount or number
table Service1_Order
-id
- and Specific fields of this service
table Service2_Order
-id
- and Specific fields of this service
table Service3_Order
-id
- and Specific fields of this service

现在,当我们想向用户显示所有订单时,我们不能将它们带到一个页面。我们必须为每项服务创建一个新的订单页面,但这是一个错误。我们如何在一个页面和一个表中显示所有订单(因为每个服务都有自己的信息(表之间应该有什么关系?

问题的细节尚不清楚,但正如我从文本中了解到的,您可以通过多态关系实现该目标,并且不需要为每个服务制作表。

点击此处了解更多

最新更新