Skip to content

Which fields are live ​

FieldHow it is shared
TextInput (text, search, tel, url), Textareacharacter by character
RichEditor without custom blocks, mentions or pluginscharacters, blocks and formatting
Select, Toggle, Checkbox, CheckboxList, Radio, ToggleButtons, TagsInput, DateTimePicker, ColorPicker, Slider, masked, email and number inputsthe latest choice wins
Repeater and Builder with simple fields insideadding, removing and moving items merge; text inputs and textareas inside items merge by character; other sub-fields take the latest choice
Many-to-many Select and CheckboxListmerge on save, unless you mark them collaborative()
FileUploadeach file is stored as soon as it is uploaded; adding, removing and reordering files merge
Passwords, media library uploads, hidden and disabled fields, lists holding uploads, rich text or nested listsmerge on save
The rich editor, live

Turn a field off, for example one that only some people should change:

php
TextInput::make('internal_notes')->collaborative(false);

Let only some people edit a field live, with a Gate ability. The field is shared with everybody; those the Gate refuses still edit it, and their change merges on save:

php
TextInput::make('seo_title')->collaborative('edit-seo');

Prefer this to a closure such as fn () => Gate::allows(...): a closure decides whether the field is in the draft at all, which must be the same for everybody.

Turn a relationship field on. Many-to-many fields are saved through the relationship, so they are off by default. Mark them to share the chosen ids:

php
Select::make('tags')->relationship('tags', 'name')->multiple()->collaborative();

Turn live editing off for the whole panel or for some records. People still see each other, and saving still merges:

php
CollaborationPlugin::make()
    ->liveEditing(fn (?Model $record): bool => ! $record?->is_locked);

Fields from other packages, and fields that cannot be live ​

A field the package does not know, such as a third-party editor, merges on save. People still see who is in it, and while somebody is, everybody else reads "Bob is editing this field. Changes merge when saved." under it.

  • Lock it while somebody is in it, so two people never change it at once: ->lockWhileEditing() on the field, or CollaborationPlugin::make()->lockWhileEditing() for every field that cannot be live (->lockWhileEditing(false) exempts one). The field is read-only for the others until that person leaves it or goes idle.
  • Share its whole value live with ->collaborative(): the latest change wins, through Livewire state, so most editors update for everybody without any code. For merging by character and carets, write an adapter.

Translated pages (a locale switcher, such as lara-zeus/spatie-translatable's) are live too, with one shared draft per language. Everybody on the record is in one room and sees each other, while English typing stays in the English draft and Chinese in the Chinese one. Switching language moves your page to that language's draft, including colleagues' unsaved typing there. Saving publishes the language you are on; the others keep what is stored, and their drafts are saved from their own language.

Bob in the Chinese draft while Alice is in the English one

Date pickers with a personal timezone always merge on save, because their state differs per person.

Released under the MIT License.