Skip to content

Retrieving logs from a model (not causer) #800

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

You must be logged in to vote

Hey, the trait included is the Spatie\Activitylog\Traits\LogsActivity one which also provides automatic model change logging.
https://spatie.be/docs/laravel-activitylog/v3/advanced-usage/logging-model-events

If you only want the relationship just copy the relationship method.

public function activities(): MorphMany
{
    return $this->morphMany(ActivitylogServiceProvider::determineActivityModel(), 'subject');
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Gummibeer
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