RFFRED
3 months ago
171
0
Laravel

Editing parts of a model from multiple screen & logging

Posted 3 months ago by RFFRED

Hi,

I have a model called core_settings It has 2 fields. SiteName and Status I have 2 controllers. 1 to go to a screen to edit SiteName and the other one to go and edit the website status (live or maintenance) When saving each screen, the core_settings model's observer triggers the "updated" function where I want to log what has been saved. In both cases the core_settings model has been updated and logging the core settings has been updated is not enough. I need to log which screen has been updated. I do not really want to do it in the controller. Not in the repository either. I though the observer would be a good place to do it. Is it? or is there a better place to do it? Another way of doing what I am trying to do? I guess I can detect the page edited in the observer and log the relevant message.

Please sign in or create an account to participate in this conversation.