P
P
Pavel Andreichenko2019-06-18 16:01:13
Design patterns
Pavel Andreichenko, 2019-06-18 16:01:13

Where is the best place to get data from API (MVC)?

Good day!
Can you please tell me where it is more correct to receive data from a third-party API, in a model or controller?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kafkiansky, 2019-06-19
@MB116

Neither there nor there. You do not output data on the site directly from the api, but save it somewhere before outputting it. Accordingly, the controller is not needed here. Or a console command, or some kind of handler / service, and already twitch your hands, if necessary, in the controller.

S
Sanes, 2019-06-18
@Sanes

More logical in the controller. The model here seems to be completely out of place.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question