i am working on search module in laravel.. when i submit a keyword in search input at the result i get only one record.. but i have multiple user on a single name. how to get multiple users on same name.. i tried this
Controller
class SearchController extends Controller
{
public function find(Request $request)
{
$search=$request->input('search-input');
$getUser = User::join('personalinfos', 'users.id', '=', 'personalinfos.user_id')->where('users.firstName', 'like', '%' . $search . '%')
->orWhere('users.lastName', 'like', '%' . $search . '%')->get();
return view('pages/search-users',compact('getUser'));
}
}
Form
<form class="navbar-form navbar-right hidden-sm" id="search-form" action="{{url('/find')}}" method="get">
{{ csrf_field() }}
<div class="form-group">
<i class="icon ion-android-search"></i>
<input type="text" class="form-control" id="search-input" name="search-input" placeholder="Search friends, photos, videos">
</div>
</form>
Route
Route::get('find', 'SearchController@find');