Skip to content

Activity gets logged twice #754

Answered by Gummibeer
astarialexi asked this question in Q&A
Discussion options

You must be logged in to vote

Hey,

do you use the package traits on any model?
https://docs.spatie.be/laravel-activitylog/v3/advanced-usage/logging-model-events/
I highly recommend to do so, because they keep track on model events by default and will create a log automatically.

I don't know backpack, but could it be that backpack uses the activitylog by default? And your custom log is the duplicate?

Your belongsTo relationship is right - the model with the foreign ID in it's own table is the one that belongs to the model with only its primary ID.
https://laravel.com/docs/7.x/eloquent-relationships#one-to-many

user:
- id
- user_type_id
- email

user_type:
- id
- type

The User model belongs to the UserType model and the

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@astarialexi
Comment options

@Gummibeer
Comment options

@astarialexi
Comment options

Answer selected by astarialexi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants