You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/2.essentials/1.integration-patterns.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -203,6 +203,9 @@ Override these methods to customize board behavior for your specific needs.
203
203
204
204
Override `moveCard()` to add custom logic when cards are moved:
205
205
206
+
#### Simple Updates
207
+
For basic updates on the exact same model, you can call the parent method and append your logic:
208
+
206
209
```php
207
210
public function moveCard(
208
211
string $cardId,
@@ -222,6 +225,40 @@ public function moveCard(
222
225
}
223
226
}
224
227
```
228
+
#### Data Integrity with Transactions (Recommended)
229
+
If your custom logic involves complex state machines or updating secondary tables (like activity logs), it is highly recommended to wrap the override in a database transaction. Because parent::moveCard() executes a database update immediately, wrapping the entire method ensures that if your custom logic fails, the database safely rolls back. The frontend's optimistic UI will then gracefully snap the card back to its original column.
230
+
231
+
```php
232
+
use Illuminate\Support\Facades\DB;
233
+
234
+
public function moveCard(
235
+
string $cardId,
236
+
string $targetColumnId,
237
+
?string $afterCardId = null,
238
+
?string $beforeCardId = null
239
+
): void {
240
+
DB::transaction(function () use ($cardId, $targetColumnId, $afterCardId, $beforeCardId) {
241
+
// Let Flowforge handle the stage and position math
0 commit comments