mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
Relation类save方法支持传入模型对象
This commit is contained in:
@@ -453,6 +453,9 @@ class Relation
|
|||||||
*/
|
*/
|
||||||
public function save($data, array $pivot = [])
|
public function save($data, array $pivot = [])
|
||||||
{
|
{
|
||||||
|
if ($data instanceof Model) {
|
||||||
|
$data = $data->toArray();
|
||||||
|
}
|
||||||
// 判断关联类型
|
// 判断关联类型
|
||||||
switch ($this->type) {
|
switch ($this->type) {
|
||||||
case self::HAS_ONE:
|
case self::HAS_ONE:
|
||||||
|
|||||||
Reference in New Issue
Block a user