我的表中有 level_name 字段然后里面有 [level1,level2,level3,level4,level5],现在我只想让 level1 到 level3 我如何在我的控制器中构造它
控制器:
$levels=Level::orderBy('id','asc')->where(['level_name'=>[level1,level2,level3]])->get();
return view('markbook.show_level',compact('levels'));
whereIn
代替使用where
$levels = Level::orderBy('id','asc')->whereIn('level_name', [level1,level2,level3])->get();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句