php - How can we write multiple column search with the help of laravel and mongo? -


in laravel project, have search field in listing page search email, firstname , lastname when type firstname , lastname result not getting. database using mongo. using package connect mongo "https://github.com/jenssegers/laravel-mongodb". think better result need use raw method right? if how can add mongo query raw(). please me beginner in mongo.

$users     = userlist::select('_id', 'usremail', 'usrfirstname', 'usrlastname')                         ->where(function($query) use ($search) {                             $query->where('usremail', 'like', "%{$search}%")                                 ->orwhere('usrfirstname', 'like', "%{$search}%")                                 ->orwhere('usrlastname', 'like', "%{$search}%");                         })                         ->skip($start)                         ->take($limit)                         ->orderby($order, $dir)                         ->get(); 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -