diff --git a/src/Morph.php b/src/Morph.php index b9c7154..071dd3d 100644 --- a/src/Morph.php +++ b/src/Morph.php @@ -115,9 +115,7 @@ protected function queryCleanOrphan(Model $parentModel, Relation $relation, bool ) { $query->select(DB::raw(1)) ->from($parentModel->getTable()) - ->whereRaw( - $parentModel->getTable().'.'.$parentModel->getKeyName().' = '.$childTable.'.'.$childFieldId - ); + ->whereColumn($parentModel->getTable() . '.' . $parentModel->getKeyName(), '=', $childTable . '.' . $childFieldId); })->$method(); }