У меня небольшая проблема с тем, что результат поиска отображается даже без ключей поиска. вот фрагмент. это представление:
<form action="/search" method="GET">
<div class="form-group search-location">
<input type="text" name="cityKey" id="cityKey" value="{{ request()->input('cityKey') }}"
class="form-control" >
</div>
<div class="form-group search-info">
<input type="text" name="key" id="key" value="{{ request()->input('key') }}"
class="form-control" >
</div>
<button type="submit" class="btn btn-primary search-btn"><i class="fas fa-search"></i>
<span>search</span></button>
Вот контроллер:
public function search(Request $request){
$cityKey = $request->cityKey;
$key = $request->key;
$doctors = Doctor_list::where('speciality_title', 'LIKE', '%' . $key . '%')->
where('location', 'LIKE', '%' . $cityKey . '%')->
orWhere('doctors_name', 'LIKE', '%' . $key . '%')->
where('location', 'LIKE', '%' . $cityKey . '%')->
orWhere('speciality_type', 'LIKE', '%' . $key . '%')->
where('location', 'LIKE', '%' . $cityKey . '%');
// завершите запрос и завершите его с помощью paginate или -> get () $ doctor = $ доктора-> получить ();
return view('search', compact('doctors'));
}