Skip to content

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:

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.

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:

blade
{{-- Inside the component --}}
<x-collaboration::comments />
<x-collaboration::comments field="title" />   {{-- only the title's comments --}}

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 */);

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:

blade
<x-collaboration::history />

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.

Released under the MIT License.