mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
调整
This commit is contained in:
@@ -1998,7 +1998,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
$trace = debug_backtrace(false, 2);
|
||||
$morph = Loader::parseName($trace[1]['function']);
|
||||
}
|
||||
$type = $type ?: Loader::parseName($this->name);
|
||||
$type = $type ?: get_class($this);
|
||||
if (is_array($morph)) {
|
||||
list($morphType, $foreignKey) = $morph;
|
||||
} else {
|
||||
@@ -2024,7 +2024,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
$trace = debug_backtrace(false, 2);
|
||||
$morph = Loader::parseName($trace[1]['function']);
|
||||
}
|
||||
$type = $type ?: Loader::parseName($this->name);
|
||||
$type = $type ?: get_class($this);
|
||||
if (is_array($morph)) {
|
||||
list($morphType, $foreignKey) = $morph;
|
||||
} else {
|
||||
|
||||
@@ -248,7 +248,7 @@ class MorphTo extends Relation
|
||||
$pk = $model->getPk();
|
||||
|
||||
$this->parent->setAttr($morphKey, $model->$pk);
|
||||
$this->parent->setAttr($morphType, basename(get_class($model)));
|
||||
$this->parent->setAttr($morphType, get_class($model));
|
||||
$this->parent->save();
|
||||
|
||||
return $this->parent->setRelation($this->relation, $model);
|
||||
|
||||
Reference in New Issue
Block a user