0👍
Controller method looks like overenginired.
You should do something like this.
$employees = Employee::with('Company')
->when($request->filled('q'), function ($query) use ($request) {
return $query
->where('name', 'like', "%$request->q%")
->whereHas('Company', function ($query) use ($request) {
return $query->where('name', 'like', "%$request->q%");
});
})->paginate(5);
put your field name.
- [Vuejs]-Laravel vue pagination return invalid prop type check failed for prop
- [Vuejs]-Vue JS axios HTTP500 Internal Server
Source:stackexchange.com