tp5 关联删除

        $cateInfo = model('Songcate')->with('song,song.comment')->find($id);
        foreach ($cateInfo['song'] as $v) {
            $v->together('comment')->delete();
        }
        $res = $cateInfo->together('song')->delete();

 

posted @ 2020-07-24 13:40  一颗糊涂淡  阅读(683)  评论(0编辑  收藏  举报