Answer the question
In order to leave comments, you need to log in
How to display data from different models on one page in laravel?
Good evening. There are three models: posts, categories and tags whose information needs to be displayed on one page, for example, editing a post.
Question: how to implement this feature in the right way in laravel?
It is clear that I can collect the data I need from three tables in one controller method and pass it to the view, but in this case, at least I lose flexibility, and at the maximum, this method seems to me not correct from the point of view of code architecture.
Please correct me if I'm wrong somewhere. Thanks for the help!
Answer the question
In order to leave comments, you need to log in
And what prevents you from making relays in the model and creating a resource through which to give the necessary data, taking into account the connections.
The session will process the data from the model. Pass it to the template
data from three tables in one controller method and pass them to the view, but in this case, at least I lose my flexibility, and as a maximum, this method seems to me not correct from the point of view of the code architecture.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question