How can I autonomous calculate and update value for one column in my Laravel project? I have no much experience in web-dev, so I just dont how to do it effective.
For example, now I’ve column “Condition” that calculates every time user open main page, I know its a dumb solve, so I want to update this “Condition” column every time when column “Count” (just any count) was changed and do it autonomous. I thought about events and listeners, but have too few information about how correctly communicate with this in my case.
In C#, for example, it was too easy, just subscribe to any event and do what u want. Here I need something likes columnWasChanged('Count')
-> so call event/listener handler.
Thanks!
I tried:
//...ControllersMyController.php
public function index() {
...
...
event(new UpdateConditionEvent($request));
...
}
//...ListenersConditionUpdateListener.php
public function handle(UpdateConditionEvent $event) {
//...updatuing...
}