File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -269,13 +269,13 @@ In order for this to work properly on multiple columns, you should implement a c
269269
270270Search logic example:
271271```
272- 'search_logic' => function ($query, $searchTerm ) {
273- return $query->where(function ($q) use ($searchTerm ) {
274- collect(explode(' ', $searchTerm ))->each(function ($searchTermPart ) use ($q) {
275- $q->where(function ($sq) use ($searchTermPart ) {
276- $sq->where('company', 'LIKE', '%' . $searchTermPart . '%')
277- ->orWhere('contact_name', 'LIKE', '%' . $searchTermPart . '%')
278- ->orWhereRaw('LOWER(JSON_EXTRACT(address, "$.postcode")) LIKE \'" ' . strtolower($searchTermPart ) . '%\'');
272+ 'search_logic' => function ($query, $searchTerms ) {
273+ return $query->where(function ($q) use ($searchTerms ) {
274+ collect(explode(' ', $searchTerms ))->each(function ($searchTerm ) use ($q) {
275+ $q->where(function ($sq) use ($searchTerm ) {
276+ $sq->where('company', 'LIKE', '%' . $searchTerm . '%')
277+ ->orWhere('contact_name', 'LIKE', '%' . $searchTerm . '%')
278+ ->orWhereRaw('LOWER(JSON_EXTRACT(address, "$.postcode")) LIKE \'% ' . strtolower($searchTerm ) . '%\'');
279279 });
280280 });
281281 })->orderBy('name');
You can’t perform that action at this time.
0 commit comments