Skip to content

Commit f38446a

Browse files
committed
Update README.md
1 parent 23d5a9f commit f38446a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,13 @@ In order for this to work properly on multiple columns, you should implement a c
269269

270270
Search 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');

0 commit comments

Comments
 (0)