Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Commit 79216b1

Browse files
committed
Fix that relations save the model leading to sql constraint issues
1 parent e475d72 commit 79216b1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Relations/BelongsToFactoryRelation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function make(Model $model): Model
2929
public function create(Model $model): Model
3030
{
3131
$relative = $this->convertRelative($this->relatives[0]);
32-
$model->{$this->relation}()->associate($relative)->save();
32+
$model->{$this->relation}()->associate($relative);
3333

3434
return $model;
3535
}

src/Relations/MorphToFactoryRelation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function make(Model $model): Model
2626
*/
2727
public function create(Model $model): Model
2828
{
29-
$model->{$this->relation}()->associate($this->convertRelative($this->relatives[0]))->save();
29+
$model->{$this->relation}()->associate($this->convertRelative($this->relatives[0]));
3030

3131
return $model;
3232
}

0 commit comments

Comments
 (0)