V
V
Vladimir Grabko2016-06-09 11:15:28
go
Vladimir Grabko, 2016-06-09 11:15:28

Where to write requests for services?

Since the indexing of js applications by search engines, I quickly began to think what to do. It immediately occurred to me to make a Go muzzle. Pokovyryal couple of days its templating engine. Did not like.
I took php and wrote a client for my services on it (with amendments. Now instead of hashes + open data, xxtea + base64 goes over the network. It eats much less traffic). Fortunately, php is so simple that looking at the source code of the Go client, I also sketched php in about 10 minutes. Now the services are running in docker containers. I test and see that in general the request worked for 8 ms.
Installed laravel5. The authorization service brought it into it (yes, yes. Throw tomatoes at it). I write all the logic in models, and in controllers it’s just validation and calling a view. See MVC active model.
I was also going to write requests to services in the model. So far, I like everything (perhaps because of PHP's static typing. Not the point). But here I asked a question because suddenly you can make it even more beautiful, but I don’t even know.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-06-09
@VGrabko

See MVC active model.

Where to see? The model is always active, it is also a model. And when the logic in the controllers is the lack of separation.
In PHP, typing is dynamic, and even worse, weak dynamic.
In addition to eloquent models, you have the opportunity to create services. There you go and drink. The controller does not care who is the "model", entities or services. Their task is to request the state and form a passive view.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question