Write Path
The write path in Laravel Chorus handles how client-side changes are processed, validated, and synchronized back to the server. This system enables optimistic updates, offline support, and robust conflict resolution.Write Path Overview
Chorus Actions
Chorus Actions are server-side classes that handle client write operations with validation, authorization, and business logic. They can execute multiple database operations in a single transaction.Basic Chorus Action
Simple Update Action
Delete Action
Chorus Action Configuration
Action Registration
Register Chorus Actions in your routes:Automatic Features
All Chorus Actions automatically support:- Offline writes - Operations are queued when offline and synced when reconnected
- Batch operations - Multiple items can be processed in a single request
- Optimistic updates - UI updates immediately while server processes in background
Single Operation Shorthand
For actions with only one operation rule, you can use a simplified data format:Client-Side Chorus Actions
Using Generated Action Functions
Chorus generates TypeScript functions for each registered action:Shadow and Delta Tables
For complex offline synchronization, Chorus can use shadow tables to track local changes.Shadow Table Concept
Shadow tables store a copy of the server data, allowing detection of both local and server changes:Next Steps
Advanced Features
Explore advanced configuration and multi-tenancy
React Integration
Use Chorus Actions in your React components
The write path is where Laravel Chorus shines, providing robust offline support, conflict resolution, and validation while maintaining instant user experiences through optimistic updates. With Chorus Actions, you can execute multiple operations atomically in a single transaction.