hi ,
when i log my users activity i want to pass some unregistered user id to causedBy and thats because we are working on a microservice and i am getting the user id from some other service and i dont save them in my database but i want to know which user id have done what actions in my database so i get the user id in my controller but i dont know how to pass the id thruogh the causedBy because it gives the unidentified user error and dont log the action .
Hey,
the problem is much larger. The causer columns are a polymorphic relation with the corresponding causer method.
We also load the causer to format the message to replace placeholders like :causer.name. So if you really want to do this I recommend to use the custom properties to add this value. Otherwise you will have to replace a lot of logic.
What do you want to do with the ID in your system? Do you want to load data via API sometimes? Or is it just for completion to allow an admin to search for the causer manually?
actually it should shows the user name and other stuff but i think my co worker can write some api to get the id from my property api and show user name so i think the solution is to do it with costum property so thanks this problem is solved i think :)
Ok, just another hint: logs shouldn't really depend on other systems . in best case even not other tables.
So if you need the name you should put it into the custom properties also. This will save you from requesting it all the time via API and also prevents you from handling error responses if the foreign user is deleted and you can still display the name.
@Gummibeer excuse me for not being clear enough we are not depending on any other services we just have a gateway that manages the user and the authentication of it so we just deal with the user_id that we get from gateway and for any kind of user name we send the id to gateway and get the username so we save the userid and when even we need to show that then we send request to gateway for name !!!
Most helpful comment
Hey,
the problem is much larger. The
causercolumns are a polymorphic relation with the correspondingcausermethod.We also load the causer to format the message to replace placeholders like
:causer.name. So if you really want to do this I recommend to use the custom properties to add this value. Otherwise you will have to replace a lot of logic.What do you want to do with the ID in your system? Do you want to load data via API sometimes? Or is it just for completion to allow an admin to search for the causer manually?