Ad

Octobercms Possible To Update Multiple Models In One Controller?

As the title suggests, is it possible to update multiple models in one controller? I am using Builder Plugin to deal with things. As I can see we can only choose one 'Base Model' when I create a controller. How do we do it?

Also a side question. I can see there are tabs that you can use in the form, but I never get to use them. I was up to the tabs when I consider updating multiple models, thought they might be used for such purpose.

Ad

Answer

Actually Builder is just for kick-starting your plugin or simpler plugin development,

if you need some complex kind of stuff then you need to develop/edit files your self as builder can not do that(right now).

Its totally fine that you keep multiple controller for the multiple model, personally i would say that will be the best practice

Different scenario:

But however if you want to edit other model's data from same controller and also they have relation to current model which you are currently editing then I guess we can use relation-manager to show them as relational-field which show list of related model's records and upon clicking list-item you will get modal and you can edit them there.

Another Different scenario:

May be if its not the case then you need to develop your own controller you need to render your forms and save its data manually. (as we need customized solution).

To start customization and build your solution this titorials will help you a lot.

How MVC works in October CMS:http://octobercms.com/support/article/ob-19
Rendering Lists and Forms by hand:http://octobercms.com/support/article/ob-20
Implementing a nested relationship:http://octobercms.com/support/article/ob-21

After watching this tutorials you can develop your own controller which can havemultiple formsandlistsand you cansave there data in single controller`.

Informational Note(side question's answer):

they are just tabs normal tabs, Its there because if you have model with lot of fields you can separate them category wise.

for ex:
they are just tabs normal tabs, Its there because if you have model with lot of fields you can separate them category wise.

for ex:
customer model

  • personal details can go on top level
  • residency address and business address can go in address tab
  • contact details can go in contact tab
  • social details can go in social tab etc..
Ad
source: stackoverflow.com
Ad