name(static::$name) ->hasConfigFile() ->hasViews(static::$viewNamespace) ->hasTranslations() ->hasMigrations([ 'create_comments_table', 'create_comment_mentions_table', 'create_comment_reactions_table', 'create_comment_subscriptions_table', 'create_comment_attachments_table', ]); } public function packageRegistered(): void { Relation::morphMap([ 'comment' => CommentsConfig::getCommentModel(), ]); $this->app->bind( MentionResolver::class, fn () => new (CommentsConfig::getMentionResolver()) ); $this->app->scoped( 'comments.html_sanitizer', fn (): HtmlSanitizer => new HtmlSanitizer( (new HtmlSanitizerConfig) ->allowSafeElements() ->allowRelativeLinks() ->allowRelativeMedias() ->allowAttribute('class', allowedElements: '*') ->allowAttribute('data-color', allowedElements: '*') ->allowAttribute('data-from-breakpoint', allowedElements: '*') ->allowAttribute('data-type', allowedElements: '*') ->allowAttribute('data-id', allowedElements: 'span') ->allowAttribute('data-label', allowedElements: 'span') ->allowAttribute('data-char', allowedElements: 'span') ->allowAttribute('style', allowedElements: '*') ->allowAttribute('width', allowedElements: 'img') ->allowAttribute('height', allowedElements: 'img') ->withMaxInputLength(500000) ), ); } public function packageBooted(): void { Gate::policy( CommentsConfig::getCommentModel(), CommentsConfig::getPolicyClass(), ); Event::listen(CommentCreated::class, SendCommentRepliedNotification::class); Event::listen(UserMentioned::class, SendUserMentionedNotification::class); Livewire::component('comments', Comments::class); Livewire::component('comment-item', CommentItem::class); Livewire::component('reactions', Reactions::class); FilamentAsset::register([ Css::make('comments', __DIR__.'/../resources/css/comments.css'), ], 'relaticle/comments'); } }