tp5.1 model association new updates
文
2019-06-25 11:52:32
0
1
1462
$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();

Two tables are related. I want to update a piece of data in the main table, and I need to add a new piece of data in the related table. How can I use the related model to achieve this in one step? I can't implement the above code, please give me some advice. . .

文

reply all (1)
秋香姐家的小书童

Do it in two steps, 1. Update data 2. Add new

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!