Dear laravel community,
I am writing to you as I have a very interesting challenge to solve, I have an idea, but I was willing to try to get your opinion on this.
I am using laravel to build an intervention management system. On this solution among other components we have a tool named External Communication, this tool allows a User of the system to insert a message received by any mean that is not Orchestra(the name of our tool), phone, mail, radio, whatever else. This tool is very similar to a chat but the difference is that only our users are typing, as the source of the info is someone external to our organization (say the Major of the town where a flood is happening).
The system generates Operations (data report of any action executed to the system, bound to Auth:user()), like an airplane blackbox but for the tool.
The system generates automatically notifications, based once again on the Auth::user() (who would have thought that I would get data generated…by a non-registered user?).
Now the cool part, I have been requested to create a feature that listens for emails (thanks Mailgun) and injects the text into the external communication. Everything looked fine until I started to have messages flowing into the app. At which point operations and notification tried to generate, but clearly couldn’t as this request is not coming from a registered user. And many WTF started to echo around my valley.
Now I have an idea, but I wanted to see if you had better and/or different solutions in mind. What I am planning to do is to add an abstract Agent class in the system, make User extend from it, and create a SystemAgent that extends from Agent. This should easily allow me to make operation and notification depend on Agent, rather then on user, and everything else should follow “easily”. (writing it feels so easy :grimacing:)
This is actually kind of a demanding refactoring, especially because it touches one of the central pieces of the application, and before moving I want to be sure I am moving in the right direction.
Thanks a lot for taking the time to read, and, hopefully, to be able to reply as well to it :D
In both cases I would like to thank you all for sharing your opinion and try to build a better world all together, you guys have all my admiration!
Have a wonderful week,
Enrico Bottani
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community