whereNotIn条件集合中

时间:2017-03-21 15:27:37

标签: laravel

我尝试显示所有结构id但没有连接的

 $structures = Structure::whereNotIn('id' , Auth::user()->structure->id)->pluck('id');

但它不起作用,有人知道正确的查询来实现吗?

提前多多感谢

1 个答案:

答案 0 :(得分:1)

您不应在此使用whereNotIn()。请改用where()

$structures = Structure::where('id', '<>', Auth::user()->structure->id)->pluck('id');