Skip to content

Commit a7d3acb

Browse files
authored
Set origin id on entry model to prevent foreign key constraint errors (#160)
1 parent d6651e6 commit a7d3acb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Entries/Entry.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ public function origin($origin = null)
100100
if (func_num_args() > 0) {
101101
$this->origin = $origin;
102102

103+
if ($this->model) {
104+
$this->model->origin_id = $origin instanceof EntryContract ? $origin->id() : $origin;
105+
}
106+
103107
return $this;
104108
}
105109

0 commit comments

Comments
 (0)