1User::query()
2 ->where('name', 'LIKE', "%{$searchTerm}%")
3 ->orWhere('email', 'LIKE', "%{$searchTerm}%")
4 ->get();
5
6reference:
7https://freek.dev/1182-searching-models-using-a-where-like-query-in-laravel
1$camps = $field->camps()->where('status', 0)->where(function ($q) {
2 $q->where('sex', Auth::user()->sex)->orWhere('sex', 0);
3})->get();