$user = \app\index\model\User::find($uid);
$user->totalpoint = $details['integral'] + $user['totalpoint'];
$user->comment->uid = $uid;
$user->comment->type = 4;
$user->comment->bid = $id;
$user->comment->content = '观看文章获取';
$user->comment->num = $details['integral'];
$user->together('comments')->save();两张表关联,主表我要更新一条数据,关联表我需要新增一条数据,怎么用关联模型一步到位实现? 面代码我尝试实现不了,求大神指点。。。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
分两步做,1.更新数据 2.新增