condoedge/discussions
Composer 安装命令:
composer require condoedge/discussions
包简介
Channels, discussions and chat components for Kompo applications
README 文档
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.
统计信息
- 总下载量: 2.72k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-01