【问题标题】:Relationships between several tables in LaravelLaravel 中几个表之间的关系
【发布时间】:2021-09-11 23:53:39
【问题描述】:

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

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

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

【问题讨论】:

    标签: mysql laravel migration relationship


    【解决方案1】:

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

    了解更多here

    【讨论】:

      猜你喜欢
      • 2016-06-27
      • 2017-07-31
      • 1970-01-01
      • 1970-01-01
      • 2018-03-08
      • 2022-01-09
      • 2016-09-03
      • 2020-10-13
      • 2018-09-22
      相关资源
      最近更新 更多