Skip to content

Make activity model configurable instead of hardcoded.#26

Merged
AsmitNepali merged 3 commits into
relaticle:1.xfrom
MrSleeps:1.x
Jun 12, 2026
Merged

Make activity model configurable instead of hardcoded.#26
AsmitNepali merged 3 commits into
relaticle:1.xfrom
MrSleeps:1.x

Conversation

@MrSleeps

Copy link
Copy Markdown
Contributor

The package currently hardcodes Spatie\Activitylog\Models\Activity in both source classes. If you're using a custom Activity model (like a different table name or extra methods) it breaks. As far as I can see and have tested, there's no breaking changes. If someone doesn't set the config, it works exactly like before.

Changes:

  • Added a getActivityModelClass() method that pulls the model class from config
  • Defaults to the original Spatie model so existing installs don't break
  • Updated ActivityLogSource and RelatedActivityLogSource to use the configurable model

@AsmitNepali
AsmitNepali merged commit 19efe78 into relaticle:1.x Jun 12, 2026
1 check passed
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.

2 participants