Comments, version history and image uploads are optional. Turn on the ones you want in a service provider. A feature that is off registers no routes, creates no table, and ships no script:
php
use SolutionForest\Collaboration\Features;Collaboration::features([Features::comments(), Features::history(), Features::uploads()]);
Their components have their own imports too, so an app without them doesn't bundle them.
With Features::comments() on, people can comment on a record, or on one field of it, and resolve comments when they're done:
blade
{{-- Inside the component --}}<x-collaboration::comments /><x-collaboration::comments field="title" /> {{-- only the title's comments --}}
jsx
import { Comments } from '@solutionforest/laravel-collaboration/react/comments'<Comments form={form} /><Comments form={form} field="title" /> // only the title's comments
vue
<script setup>import { Comments } from '@solutionforest/laravel-collaboration/vue/comments'</script><template> <Comments :form="form" /> <Comments :form="form" field="title" /> <!-- only the title's comments --></template>
useComments(form) gives the list and post(), resolve() and reopen() for your own UI. Say who may be mentioned, and send your own notifications from the CommentPosted event:
php
Collaboration::mentionUsersUsing(fn (Post $post) => $post->team->users);Event::listen(CommentPosted::class, fn (CommentPosted $event) => /* notify each of $event->comment->mentions */);
The shared draft keeps versions while people edit, every few minutes, and at each save. With Features::history() on, show them, and let editors bring one back for everybody:
blade
<x-collaboration::history />
jsx
import { History } from '@solutionforest/laravel-collaboration/react/history'<History form={form} />
vue
<script setup>import { History } from '@solutionforest/laravel-collaboration/vue/history'</script><template> <History :form="form" /></template>
Restoring keeps the draft as it was in the history too, so it can be undone. useVersions(form) gives the list and restore() for your own UI.
Comments and history
Optional features
Comments, version history and image uploads are optional. Turn on the ones you want in a service provider. A feature that is off registers no routes, creates no table, and ships no script:
Their components have their own imports too, so an app without them doesn't bundle them.
Comments and @mentions
With
Features::comments()on, people can comment on a record, or on one field of it, and resolve comments when they're done:useComments(form)gives the list andpost(),resolve()andreopen()for your own UI. Say who may be mentioned, and send your own notifications from theCommentPostedevent:Version history
The shared draft keeps versions while people edit, every few minutes, and at each save. With
Features::history()on, show them, and let editors bring one back for everybody:Restoring keeps the draft as it was in the history too, so it can be undone.
useVersions(form)gives the list andrestore()for your own UI.