A
A
Alexander Filippenko2018-05-10 13:52:01
Laravel
Alexander Filippenko, 2018-05-10 13:52:01

Where to place requests to third party REST?

Good afternoon. There is a small project on Laravel, the whole point is to ensure the interaction of 2 third-party services via their REST API. Now requests to them are in controllers as static methods. There is a suspicion that this approach is not correct, but I don’t understand where exactly and how to place such things? In models? There are examples?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
D3lphi, 2018-05-10
@alexfilus

There is a suspicion that this approach is not correct

Absolutely. It is not clear what you were guided by when you wrote statics, and even in the controller. Read on to avoid doing this in the future.
Take out the logic of interaction in service classes, what's the problem? We share the very logic of interaction - this is the infrastructure layer and data processing - this is the business logic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question