condoedge / discussions
Channels, discussions and chat components for Kompo applications
Requires
- php: ^8.1
- condoedge/utils: ^0.2.0
- kompo/auth: *
- kompo/kompo: *
- laravel/framework: >=5.6.0
This package is auto-updated.
Last update: 2026-06-13 18:01:21 UTC
README
Channels, discussions and chat components for Kompo applications.
What it provides
- Models:
Channel,Discussion(self-referencing for replies/subjects),DiscussionRead(read receipts),DiscussionBox(archive/trash per user),Member(channel membership pivot). - Komponents:
ChannelsView(3-column chat page),ChannelsList/ChannelsListTeam,ChannelSubjectsList,ChannelDiscussionsPanel,DiscussionForm,SingleDiscussionCard,ProjectDiscussionThread,ChannelSettingsForm. - Policies:
ChannelPolicy/DiscussionPolicy, registered automatically (membership-based). - Broadcasting: a
DiscussionSentevent broadcast on the private channeldiscussion.{teamId}; the channel authorization callback is registered by the package's service provider.
Installation
composer require condoedge/discussions
The service provider is auto-discovered. Migrations load automatically (php artisan migrate).
Route registration
The package does not auto-register routes. Call the static registrars from your app's route files, inside your auth middleware group:
Route::middleware(['auth'])->group(function () { \Kompo\Discussions\Services\DiscussionsService::setAllRoutes(); // discussions pages \Kompo\Discussions\Services\DiscussionsService::setAllModalRoutes(); // channel-settings modal });
Live refresh (Pusher)
The chat lists refresh live through Laravel broadcasting. The host app must have broadcasting enabled:
- Enable
App\Providers\BroadcastServiceProviderinconfig/app.php(registers/broadcasting/auth). - Set
BROADCAST_DRIVER=pusherand thePUSHER_*/MIX_PUSHER_*env values. composer require pusher/pusher-php-server.- Make sure the front-end bundle initializes Echo (kompo's
withBroadcasting()).
The package takes care of the rest: the discussion.{teamId} channel authorization (team membership) and the event-name wiring between DiscussionSent::broadcastAs() and the komponents' pusherRefresh.
Styling
Import the package stylesheet in your app's scss:
@import "../../vendor/condoedge/discussions/resources/scss/discussions";
The chat page (.discussions-page) sizes itself to the area below your app's navbar; no fixed viewport heights are used.
Host integration points
- Listen to
Kompo\Discussions\Events\DiscussionSent(exposesgetDiscussion()) for notifications. - Override the team users available in a channel by defining
getAvailableUsersForChannel($channel, $search)on your Team model. - Translations are flat JSON keys (
discussions.*) for theenandfrlocales; app-level JSON translations override them.