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

Fixes causer not being set on ActivityLog when using a different guard other than Laravel's default #1053

Merged
merged 1 commit into from
May 31, 2022

Conversation

Gnative
Copy link
Contributor

@Gnative Gnative commented May 29, 2022

This fixes an issue that can cause the causer to not be applied to an ActivityLog if using any guard other than Laravels default 'web' guard.

Using $this->authManager->getDefaultDriver() forces $this->authManager->guard($this->authDriver)->user() in getDefaultCauser to use that guard. This change allows the authManager to return the authenticated user of the current guard.

For example: When testing and using Sanctum::actingAs($user), which uses the 'sanctum' guard, this would previously use the web guard and not return the authenticated user.

I'm not sure how to apply testing for this.

@Gnative Gnative changed the title Fixes causer not being set when using a different guard other than laravel's default Fixes causer not being set on ActivityLog when using a different guard other than laravel's default May 29, 2022
@Gnative Gnative changed the title Fixes causer not being set on ActivityLog when using a different guard other than laravel's default Fixes causer not being set on ActivityLog when using a different guard other than Laravel's default May 29, 2022
Copy link
Collaborator

@Gummibeer Gummibeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - looking good! 🎉

@Gummibeer Gummibeer merged commit d8daeca into spatie:main May 31, 2022
@Gummibeer
Copy link
Collaborator

@Gnative
Copy link
Contributor Author

Gnative commented May 31, 2022

@Gummibeer Thanks to you and the Spatie team for the many packages.

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

Successfully merging this pull request may close these issues.

None yet

2 participants