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