mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
改进关联的save方法
This commit is contained in:
@@ -202,7 +202,9 @@ class HasMany extends Relation
|
|||||||
*/
|
*/
|
||||||
public function save($data)
|
public function save($data)
|
||||||
{
|
{
|
||||||
$model = $this->make($data);
|
$model = $this->make();
|
||||||
|
$data = array_merge($model->getData(), $data);
|
||||||
|
|
||||||
return $model->save($data) ? $model : false;
|
return $model->save($data) ? $model : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,8 @@ class MorphMany extends Relation
|
|||||||
*/
|
*/
|
||||||
public function save($data)
|
public function save($data)
|
||||||
{
|
{
|
||||||
$model = $this->make($data);
|
$model = $this->make();
|
||||||
|
$data = array_merge($model->getData(), $data);
|
||||||
|
|
||||||
return $model->save($data) ? $model : false;
|
return $model->save($data) ? $model : false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,8 +199,10 @@ class MorphOne extends Relation
|
|||||||
*/
|
*/
|
||||||
public function save($data)
|
public function save($data)
|
||||||
{
|
{
|
||||||
$model = $this->make($data);
|
$model = $this->make();
|
||||||
return $model->save() ? $model : false;
|
$data = array_merge($model->getData(), $data);
|
||||||
|
|
||||||
|
return $model->save($data) ? $model : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user