You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to perform this code with using jeroen-g/explorer and laravel/scout package. $query = Library::sortable()->where(DB::raw('LOWER(TRIM(name))'), 'LIKE', '%' . $searchQuery . '%')->orWhereHas('book', function ($query) use ($searchQuery) { $query->where(DB::raw('LOWER(TRIM(name))'), 'LIKE', '%' . $searchQuery . '%'); }); Can anyone explain to me how to fetch records from both tables? Right now, I'm just thinking about pulling the two records separately and merging them like: $query1 = Library::search($searchQuery); $query2 = Book::search($searchQuery); //logic of combining
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone,
I am trying to perform this code with using jeroen-g/explorer and laravel/scout package.
$query = Library::sortable()->where(DB::raw('LOWER(TRIM(name))'), 'LIKE', '%' . $searchQuery . '%')->orWhereHas('book', function ($query) use ($searchQuery) { $query->where(DB::raw('LOWER(TRIM(name))'), 'LIKE', '%' . $searchQuery . '%'); });
Can anyone explain to me how to fetch records from both tables? Right now, I'm just thinking about pulling the two records separately and merging them like:$query1 = Library::search($searchQuery); $query2 = Book::search($searchQuery); //logic of combining
Beta Was this translation helpful? Give feedback.
All reactions