thinkphp6 with sql执行结果

作者: 分类: php 时间: 2023-02-24 评论: 暂无评论
class UserVip extends Model
{

}
class User extends Model
{

    public function vip(){
        return $this->hasOne("UserVip",'user_id','user_id');
    }
}

User::with('vip')->whereIn('user_id',['1001691305','1000100023'])->select();

Sql执行结果:

[sql] SELECT * FROM `yoshop_user` WHERE  `user_id` IN (1001691305,1000100023) 
[sql] SELECT * FROM `yoshop_user_vip` WHERE  `user_id` IN (1000100023,1001691305)
标签: none

订阅本站(RSS)