$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();
兩張表關聯,主表我要更新一條數據,關聯表我需要新增一條數據,怎麼用關聯模型一步到位實現?麵代碼我嘗試實現不了,求大神指點。 。 。