这就是我在“attrib”db列数据中的含义:
["last","featured","disabled"]
我尝试在我的查询中添加类似的内容
->whereRaw('FIND_IN_SET(?,attrib)', ['featured'])
但它不起作用......
更新我已经解决了:
$featured = Course::where('attrib', 'like', '%featured%')->get();
但我仍然在寻找一个更好的查询,而不使用“LIKE”。
您可以在模型中使用whereIn()
$attrib=["last","featured","disabled"];
->whereIn('attrib',[$attrib])->get();