Skip to content

Commit 0ea547e

Browse files
committed
Merge pull request #13 from cgernert/patch-1
inserted apostrophes to fix string column conditions (e.g. WHERE stat…
2 parents 3a25e90 + f03845b commit 0ea547e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

RelationTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function saveAll($skippedRelations = [])
195195
$isManyMany = count($relModel->primaryKey()) > 1;
196196
if($isManyMany){
197197
foreach ($rel['link'] as $k => $v) {
198-
$condition[] = $k . " = " . $this->$v;
198+
$condition[] = "$k = '{$this->$v}'";
199199
}
200200
try {
201201
$relModel->deleteAll(implode(" AND ", $condition));
@@ -206,7 +206,7 @@ public function saveAll($skippedRelations = [])
206206
}else{
207207
if($rel['ismultiple']){
208208
foreach ($rel['link'] as $k => $v) {
209-
$condition[] = $k . " = " . $this->$v;
209+
$condition[] = "$k = '{$this->$v}'";
210210
}
211211
try {
212212
$relModel->deleteAll(implode(" AND ", $condition));

0 commit comments

Comments
 (0)