我尝试显示所有结构id但没有连接的
$structures = Structure::whereNotIn('id' , Auth::user()->structure->id)->pluck('id');
但它不起作用,有人知道正确的查询来实现吗?
提前多多感谢
答案 0 :(得分:1)
您不应在此使用whereNotIn()
。请改用where()
:
$structures = Structure::where('id', '<>', Auth::user()->structure->id)->pluck('id');