A
A
Abc Edc2015-08-05 21:17:26
Laravel
Abc Edc, 2015-08-05 21:17:26

Is there some kind of violation of the ideology of the framework when the controller has several models?

And how to get out of situations when you need to display a model from another in a view with one controller? Just use app\somethingModel is the only way out? Or perhaps, as in angular, it’s worth somehow making it an independent directive (I don’t know if there is such an approach at all).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
D', 2015-08-05
@gleber1

And what's the difference what models the controller uses?
It is just for this that is needed (in the general case) - to steer what to transfer to the view.
View generally does not care what is passed to it, it should just show it.
I understand that the question appeared because of the REST controller (index, update, store, ...)? Of course, you should not update / display the User model in the PostsController controller, but for example, no one forbids displaying posts + related users.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question