文档
示例如下
$users = User::whereNotIn('id', function ($query) use($user){
$query->select('user_id')
->from('tb_relation')
->where('tb_relation.userId', $user->id);
});
参考
laravel whereNotIn where子查詢
文档
示例如下
$users = User::whereNotIn('id', function ($query) use($user){
$query->select('user_id')
->from('tb_relation')
->where('tb_relation.userId', $user->id);
});
参考
laravel whereNotIn where子查詢