gismatul / nova-support-chat
Laravel Nova admin panel for gismatul/laravel-support-chat: read, answer and close website chat conversations.
Requires
- php: ^8.2
- gismatul/laravel-support-chat: ^1.2
- laravel/nova: ^4.35|^5.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- phpunit/phpunit: ^10.0|^11.0|^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A Laravel Nova panel for gismatul/laravel-support-chat: read, answer and close website chat conversations from Nova. Answers appear in the customer's chat widget and are mirrored to your Telegram support group.
Requires Nova 4.35+ or Nova 5, and PHP 8.2+.
Installation
composer require gismatul/nova-support-chat php artisan support-chat:install
Then register the tool in app/Providers/NovaServiceProvider.php:
use Gismatul\NovaSupportChat\SupportChatTool; public function tools() { return [ SupportChatTool::make(), ]; }
That's it. You get:
- Support Chat in the main menu, with a badge counting conversations that are waiting for an answer
- a Conversations resource (search, status filter, auto-refresh), read-only by design
- on each conversation, a live thread with a reply box (Ctrl/⌘+Enter to send) and a Close conversation button
- a Close conversation action for one or many conversations
- a Settings page (contact fields, auto-close, retention)
If you define your own Nova::mainMenu(), add the section yourself: SupportChatTool::make()->menu($request).
Who can use it
By default, every user who can access Nova (your viewNova gate) can view, answer and manage support chats. To narrow it, add this to a service provider:
use Gismatul\SupportChat\SupportChat; SupportChat::authorizeUsing(fn ($user, string $ability) => match ($ability) { SupportChat::ABILITY_VIEW, SupportChat::ABILITY_REPLY => $user->hasRole('support') || $user->is_admin, SupportChat::ABILITY_MANAGE => $user->is_admin, // settings + delete });
Behind the scenes:
- The panel's API (
/nova-vendor/support-chat/*) sits behind Nova's own authentication andviewNovacheck, plus thesupportChat.*gates on every route. - The core package's
ConversationPolicymakes Nova enforce the same rules on its own resource endpoints. Creating or editing conversations is always denied. - The core package's standalone admin API (
/support-chat/admin) is switched off when this package is installed, so there is no second entry point to secure. Setdisable_core_admin_routestofalseinconfig/nova-support-chat.phpif you need it.
Configuration
php artisan vendor:publish --tag=nova-support-chat-config
| Key | Default | |
|---|---|---|
register_resource |
true |
Set to false to register your own subclass of Gismatul\NovaSupportChat\Nova\Conversation |
disable_core_admin_routes |
true |
See above |
poll_interval |
4 |
Seconds between refreshes of an open conversation |
pending_badge |
true |
Menu badge with the number of waiting conversations |
Development
The compiled assets in dist/ are committed. To rebuild them:
npm install npm run build
Vue is not bundled: the build uses the window.Vue that Nova 4 and 5 provide.
Running the tests needs access to Nova (a license, with composer credentials for nova.laravel.com):
composer install && composer test
License
MIT