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

Add causer- and subject-type scopes to Activity model #1294

Closed
wants to merge 1 commit into from

Conversation

npostman
Copy link

@npostman npostman commented Apr 16, 2024

I added 2 scopes to the Activity model for convenience. You can use these scopes to fetch only the activity for subjects of a certain class, or caused by a certain class.

$user_activity = Activity::causedByType(User::class)->get();
$admin_activity = Activity::causedByType(Admin::class)->get();

or

$activity_on_articles = Activity::forSubjectType(Article::class)->get();
$activity_on_posts = Activity::forSubjectType(Post::class)->get();

@github-actions github-actions bot added the stale label May 9, 2024
@github-actions github-actions bot closed this May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant