Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Causer in CLI Commands. #649

Closed
nospam4u opened this issue Jan 17, 2020 · 2 comments · Fixed by #866 or #787
Closed

Causer in CLI Commands. #649

nospam4u opened this issue Jan 17, 2020 · 2 comments · Fixed by #866 or #787

Comments

@nospam4u
Copy link

So I have been integrating ActivityLog into all our apps and it has worked perfectly for us. I do have a question about how I can set a causer for console commands. We have one environment where a great deal of the management orchestration takes place at the CLI, and I would like to track the Linux username of the person executing those commands. Since the Linux user doesn't exist as a Laravel user, I can't just use ->causedBy(). Currently I am just adding it to the description, but would like to be able to query these in their own column for reporting.

Are there any secrets I am missing, or is adding to to description or properties the best available method?

Thanks!

@Gummibeer
Copy link
Collaborator

Hey,
you have multiple ways to achieve this.

You could create another user model/table and relate the activity to it. The causer is also morphable, so no problem.

You could also use the json column custom properties and add it there, via JSON queries (MySQL 5.7, postgres ... support it).

Or you add a new custom column with your own migration & model and use the tap() method or even an observer to fill it.

@Gummibeer Gummibeer self-assigned this Jan 17, 2020
@Gummibeer Gummibeer mentioned this issue Sep 16, 2020
Merged
9 tasks
@nagi1 nagi1 mentioned this issue Apr 9, 2021
10 tasks
This was linked to pull requests Apr 19, 2021
Merged
nagi1 referenced this issue in nagi1/laravel-activitylog Apr 24, 2021
@Gummibeer
Copy link
Collaborator

I will close this issue even if v4 isn't released yet. But the task itself is done and I want to check which tasks are really open. Please keep an eye on #787

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants