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
The Data API lets you set a [Modification ID](https://help.claris.com/en/data-api-guide/content/edit-record.html) when editing records.
271
+
272
+
> Specifying a modification ID ensures that you are editing the current version of a record. If the modification ID value does not match the current modification ID value in the database, the record is not changed.
273
+
274
+
If you wish to include the modId when editing a record you can call `withModId()` before calling `save()` on the model object. This will send the ModID to FileMaker when updating the record, and will throw a `FileMakerDataApiException` if the ModId does not match.
275
+
276
+
```php
277
+
$person->withModId()->save();
278
+
```
279
+
280
+
The modId is automatically set on the model object when you retrieve a record from FileMaker, so you don't need to set it manually.
281
+
282
+
283
+
If you always want the ModId to be included when saving a record, you can set the `$withModId` property to true on your model class.
284
+
285
+
```php
286
+
protected $useModId = true;
287
+
```
288
+
289
+
If you wish to always include a ModId on a model, you can set`protected $withModId = true;` on your model class.
268
290
269
291
## Example FMModel Class
270
292
```php
@@ -342,7 +364,8 @@ FM::setGlobalFields() // not chainable
342
364
->portalLimit( $portalName, $limit )
343
365
->portalOffset( $portalName, $startingRecord )
344
366
->sort() // aliasfor the native orderBy()
345
-
->omit()
367
+
->omit() // change the request to an "omit" request
368
+
->modId( string $modId ) // set the modId to submit when editing a record
0 commit comments