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

@@ -1,33 +1,33 @@
<?php
use Relaticle\Comments\Config;
use Relaticle\Comments\CommentsConfig;
it('returns false for isBroadcastingEnabled by default', function () {
expect(Config::isBroadcastingEnabled())->toBeFalse();
expect(CommentsConfig::isBroadcastingEnabled())->toBeFalse();
});
it('returns true for isBroadcastingEnabled when config overridden', function () {
config()->set('comments.broadcasting.enabled', true);
expect(Config::isBroadcastingEnabled())->toBeTrue();
expect(CommentsConfig::isBroadcastingEnabled())->toBeTrue();
});
it('returns comments as default broadcast channel prefix', function () {
expect(Config::getBroadcastChannelPrefix())->toBe('comments');
expect(CommentsConfig::getBroadcastChannelPrefix())->toBe('comments');
});
it('returns custom broadcast channel prefix when overridden', function () {
config()->set('comments.broadcasting.channel_prefix', 'my-app-comments');
expect(Config::getBroadcastChannelPrefix())->toBe('my-app-comments');
expect(CommentsConfig::getBroadcastChannelPrefix())->toBe('my-app-comments');
});
it('returns 10s as default polling interval', function () {
expect(Config::getPollingInterval())->toBe('10s');
expect(CommentsConfig::getPollingInterval())->toBe('10s');
});
it('returns custom polling interval when overridden', function () {
config()->set('comments.polling.interval', '30s');
expect(Config::getPollingInterval())->toBe('30s');
expect(CommentsConfig::getPollingInterval())->toBe('30s');
});