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:
@@ -8,8 +8,8 @@ use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Relaticle\Comments\Comment;
|
||||
use Relaticle\Comments\Config;
|
||||
use Relaticle\Comments\CommentsConfig;
|
||||
use Relaticle\Comments\Models\Comment;
|
||||
|
||||
class CommentCreated implements ShouldBroadcast
|
||||
{
|
||||
@@ -27,7 +27,7 @@ class CommentCreated implements ShouldBroadcast
|
||||
/** @return array<int, PrivateChannel> */
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
$prefix = Config::getBroadcastChannelPrefix();
|
||||
$prefix = CommentsConfig::getBroadcastChannelPrefix();
|
||||
|
||||
return [
|
||||
new PrivateChannel("{$prefix}.{$this->comment->commentable_type}.{$this->comment->commentable_id}"),
|
||||
@@ -36,7 +36,7 @@ class CommentCreated implements ShouldBroadcast
|
||||
|
||||
public function broadcastWhen(): bool
|
||||
{
|
||||
return Config::isBroadcastingEnabled();
|
||||
return CommentsConfig::isBroadcastingEnabled();
|
||||
}
|
||||
|
||||
/** @return array{comment_id: int|string, commentable_type: string, commentable_id: int|string} */
|
||||
|
||||
Reference in New Issue
Block a user