0

正如标题所暗示的,是否可以在一个控制器中更新多个模型?我正在使用 Builder Plugin 来处理事情。正如我所见,当我创建控制器时,我们只能选择一个“基本模型”。我们该怎么做呢?

也是一个侧面问题。我可以看到您可以在表单中使用一些选项卡,但我从来没有使用过它们。当我考虑更新多个模型时,我正在使用选项卡,认为它们可能用于此目的。

4

1 回答 1

0

实际上Builder只是为了kick-starting your pluginor simpler plugin development,

如果你需要some complex kind of stuff那么你需要develop/edit files your self因为builder不能这样做(现在)。

为多个模型保留多个控制器完全没问题,personally i would say that will be the best practice

不同的场景:

但是,但是,如果您愿意edit other model's data from same controller并且他们也有relation to current model您的身份,currently editing那么我想我们可以使用relation-manager将它们显示为relational-field哪个节目list of related model's records,然后单击list-item您将获得modaland you can edit them there

另一个不同的场景:

可能如果不是这种情况,那么您需要手动develop your own controller获取render您的数据forms及其save数据。(因为我们需要定制的解决方案)。

要开始定制并构建您的解决方案,此教程将对您有很大帮助。

MVC 在 10 月 CMS 中的工作原理: http: //octobercms.com/support/article/ob-19
手动渲染列表和表单:http: //octobercms.com/support/article/ob-20
实现嵌套关系: http ://octobercms.com/support/article/ob-21

看完本教程后,you can develop your own controller which can have多个表单and列表and you can将数据保存在单个控制器中`。

信息说明(附带问题的答案):

它们是just tabs普通的标签,because如果你有的话,model with lot of fields你可以它们按类别分开。

例如:
客户模型

  • 个人详细信息可以放在顶层
  • 居住地址和公司地址可以进入地址选项卡
  • 联系方式可以在联系选项卡中
  • 社交细节可以进入社交标签等。
于 2018-01-26T08:55:41.937 回答