Welcome Guest, Not a member yet? Register   Sign In
How to use multiple mvcs together


Lets say I like to create a crud for a table articles.
So, I create Controller, Model and views for my articles.

I display all articles in a view loaded from  index() method.

However, in this view I also like to display a crud for stores (to interact with table stores)
So, I load stores model in articles/index() and get all stores that I send to the view along wiht the articles.

But, like I said, stores should also be a crud.
So from the view loaded from articles controller I have add, edit and delete links for stores.

I let these links go to stores controller. In the "add" case  the stores controller calls its own add() that loads a view with a form that let the user add a store. It is posted, validated and inserted from stores controller. When ready I like to redirect to articles/index(). 

The stores controller don't know where to redirect.

So, is it ok to add the return path in the article view?
Something like stores/add/artices/index

And then accept the arguments in stores controller like:

add($return_controller, $return_method){}

Then I need to send these varaibles to the stores form and then back to the stores controller to be able to finaly make my redirect:


Is this a good way of doing it?
Or should I just keep everything in my articles MVC?
Or should I try HMVC? (Can't find any tutorial for CI3 that handles crud methods)

Messages In This Thread
How to use multiple mvcs together - by muuucho - 09-25-2017, 02:01 AM

Theme © iAndrew 2016 - Forum software by © MyBB