Skip to content

Commit

Permalink
Ability to display number of unread messages in navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
abdosaeedelhassan committed Oct 3, 2024
1 parent f04720a commit ee35757
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions config/filachat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/Pages/FilaChat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ee35757

Please sign in to comment.