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
Post a Comment