我试图在特定数据上搜索id但是失败
$id=PermissionsAssignment::pluck('permission')->
where('category', $request->filter_category)->all();
当我检查var_dump($request->filter_category)
时,它有例如:1
当我表演时
$data= PermissionsAssignment::where('category','=', $request->filter_category)->get();
它产生
[
{name:'', permission:1, category:1}
{name:'two', permission:2, category:1}
....etc
]
为什么拔除不起作用,因为我希望它返回权限值。
答案 0 :(得分:1)
删除all()
来电并仅使用pluck()
$id=PermissionsAssignment::where('category', $request->filter_category)
->pluck('permission');