Trying to attach ajax search by entity to sorting in one query. The entity contains the fields firstmane and lastname, for example. Searching for one field is not difficult, like this:
$users = User::where('firstname', 'LIKE', $request->firstname)->get(); But how best to organize a search on the basis of different fields of the entity in one line on the front end? For example, the string "Sergey Iva" returned the lines of Sergey Ivanov, Sergey Ivanchenko and so on.
There are ideas in the direction of regular expressions, but can there be more simple methods?