tp5.1 모델 연관 신규 업데이트
文
2019-06-25 11:52:32
0
1
1576
$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();

두 테이블이 관련되어 있습니다. 기본 테이블의 데이터를 업데이트하고 관련 테이블에 새 데이터를 추가해야 합니다. 이를 한 단계로 수행하려면 어떻게 해야 합니까? 위의 코드를 구현할 수 없습니다. 조언을 부탁드립니다. . .

文

모든 응답(1)
秋香姐家的小书童

두 단계로 수행하세요. 1. 데이터 업데이트 2. 새로운 데이터 추가

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿