Learn how to add the Harmonics trait to your Laravel models to enable real-time synchronization.
Harmonics
trait is the foundation of Laravel Chorus. When added to your Eloquent models, it automatically tracks changes and enables real-time synchronization to connected clients.
Harmonics
trait to any model you want to synchronize:
Harmonics
trait, it automatically:
getSyncFields()
method for complex dynamic logic:
id
)title
, name
, description
)status
, is_active
)user_id
, category_id
)created_at
, updated_at
)internal_notes
)ssn
, credit_card
)file_content
)admin_notes
)Post::where('status', 'draft')->update(['status' => 'published'])
do not trigger model events and will not be synchronized automatically.For bulk operations, you’ll need to handle synchronization manually or iterate through individual models.No Harmonics Created
use Harmonics;
Fields Not Syncing
$syncFields
arrayharmonics
database table for change eventToo Much Data Syncing
$syncFields
syncFilter
query.Performance Issues