Skip to content

Commit 907bd7d

Browse files
committed
added withModId function
1 parent 97b91cf commit 907bd7d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Database/Eloquent/FMEloquentBuilder.php

+5
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ public function editRecord()
167167
}
168168
}
169169

170+
// set the ModID if that option is set on the model
171+
if ($model->withModId()) {
172+
$this->query->modId($model->getModId());
173+
}
174+
170175
if ($fieldsToWrite->count() > 0 || count($modifiedPortals) > 0) {
171176
// we have some regular text fields to update
172177
// forward this request to a base query builder to execute the edit record request

src/Database/Eloquent/FMModel.php

+13
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ abstract class FMModel extends Model
6565
*/
6666
protected $modId;
6767

68+
protected $useModId = false;
69+
6870
/**
6971
* The "type" of the primary key ID. FileMaker uses UUID strings by default.
7072
*
@@ -219,6 +221,17 @@ public function setModId($modId): void
219221
$this->modId = $modId;
220222
}
221223

224+
/**
225+
* Include the modification Id when editing a record
226+
*/
227+
public function withModId($include = true): self
228+
{
229+
// remove any set ModId if the user wishes to remove it
230+
$this->useModId = $include;
231+
232+
return $this;
233+
}
234+
222235
public function getReadOnlyFields()
223236
{
224237
return $this->readOnlyFields;

0 commit comments

Comments
 (0)