refactor: rename for Laravel conventions and better DX

- Rename IsCommenter trait to CanComment, Commenter interface to Commentator
- Move models to Models/ namespace (Comment, Reaction, Attachment, Subscription)
- Rename user_type/user_id polymorphic columns to commenter_type/commenter_id
- Rename Config class to CommentsConfig, update config key tables->table_names
- Rename getCommentName() to getCommentDisplayName() on commentator models
- Add column_names config section for commenter morph customization
- Add table_names config with all 5 tables individually configurable
- Expand translation file with structured i18n groups
- Update all Blade views, Livewire components, events, listeners, and tests
This commit is contained in:
manukminasyan
2026-03-27 14:53:12 +04:00
parent 43b66f60f3
commit fd5bc5271b
62 changed files with 733 additions and 653 deletions

View File

@@ -42,20 +42,20 @@ class CommentsServiceProvider extends PackageServiceProvider
public function packageRegistered(): void
{
Relation::morphMap([
'comment' => Config::getCommentModel(),
'comment' => CommentsConfig::getCommentModel(),
]);
$this->app->bind(
MentionResolver::class,
fn () => new (Config::getMentionResolver())
fn () => new (CommentsConfig::getMentionResolver())
);
}
public function packageBooted(): void
{
Gate::policy(
Config::getCommentModel(),
Config::getPolicyClass(),
CommentsConfig::getCommentModel(),
CommentsConfig::getPolicyClass(),
);
Event::listen(CommentCreated::class, SendCommentRepliedNotification::class);