diff --git a/config/filachat.php b/config/filachat.php index 782a8ae..9fb6815 100644 --- a/config/filachat.php +++ b/config/filachat.php @@ -192,6 +192,15 @@ */ 'navigation_label' => 'FilaChat', + /* + |-------------------------------------------------------------------------- + | Navigation Badge + |-------------------------------------------------------------------------- + | + | This option specifies the user number of unread message badge in the sidebar. + */ + 'navigation_display_unread_messages_count' => false, + /* |-------------------------------------------------------------------------- | Navigation Icon diff --git a/src/Pages/FilaChat.php b/src/Pages/FilaChat.php index 8caa87f..2b7b4ac 100644 --- a/src/Pages/FilaChat.php +++ b/src/Pages/FilaChat.php @@ -33,9 +33,12 @@ public static function getNavigationBadgeColor(): string|array|null public static function getNavigationBadge(): ?string { - return FilaChatMessage::query() - ->where('last_read_at', null) - ->where('receiverable_id', auth()->id())->count(); + if (config('filachat.navigation_display_unread_messages_count')) { + return FilaChatMessage::query() + ->where('last_read_at', null) + ->where('receiverable_id', auth()->id())->count(); + } + return parent::getNavigationBadge(); } public static function getNavigationIcon(): string|Htmlable|null