2 回答

TA贡献1951条经验 获得超3个赞
你可以使用一个数组
Personne::where([
['col1', '=', 'value1'],
['col2', '<>', 'value2'],
[Your_col, OPERATOR, value],
...
])
或者你的情况
$str = "concat('%',".$mle .",'%')";
$listpers = Personne::where([
['mle', 'LIKE', $str],
['col1', '=', 'value1'],
['col2', '<>', 'value2'],
[Your_col, OPERATOR, value],
)->get();

TA贡献1828条经验 获得超3个赞
据我了解,您需要的是 orWhere 条件:
public function search_pers(Request $request)
{
$mle = $request->input('mle');
$listpers = Personne::where('mle', 'LIKE', '%'.$mle.'%')->orWhere('nom','like','%'.$mle.'%')->get();
return view('frontend.etat_civil', ['personnes' => $listpers]);
}
另一种可能更好的选择是使用全文搜索。
- 2 回答
- 0 关注
- 140 浏览
添加回答
举报