Support the ongoing development of Laravel.io →
Architecture
Last updated 3 months ago.
0

Your right in saying that controllers shouldn't really talk to each other. It depends on your project, but it makes them tightly coupled. IE, one relies on the other a little too much.

I would approach this by firing an event. Other services can then list for that event and react as you want it to. This way, other services could fire the same event and and get responded to.

Take a look at http://laravel.com/docs/5.1/events

Hope that helps.

0

I guess that since you're building a shop, you don't have all of your business logic directly in the controller but references another class containing the actual logic. As T2theC said, you could fire an event or listen for a model event, and then perform you notification.

Maybe you can get rid of some of the code in the MessagerController and make it even more clean??

Last updated 6 years ago.
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

OlegEF OlegEF olegef Joined 8 Oct 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.