Skip to content

Commit cf78a25

Browse files
committed
Merge branch 'feature-searchable' of https://github.com/DeltaSystems/laravel-livewire-tables into feature-searchable
# Conflicts: # src/Traits/WithFilters.php
2 parents 589cbe0 + 8aa0c53 commit cf78a25

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/Traits/WithFilters.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function getFilterOptions(string $filter): array
195195
*/
196196
public function getSearchableColumns() : array
197197
{
198-
return array_filter($this->columns(), function(Column $column) {
198+
return array_filter($this->columns(), function (Column $column) {
199199
return $column->isSearchable();
200200
});
201201
}
@@ -218,7 +218,6 @@ public function applySearchFilter(Builder $query): Builder
218218

219219
// group search conditions together
220220
$query->where(function (Builder $subQuery) use ($search, $query) {
221-
222221
foreach ($this->getSearchableColumns() as $column) {
223222

224223
// does this column have an alias or relation?
@@ -256,11 +255,9 @@ public function applySearchFilter(Builder $query): Builder
256255
$subQuery->orWhereHas($relationName, function (Builder $hasQuery) use ($fieldName, $column, $search) {
257256
$hasQuery->where($fieldName, 'like', '%' . $search . '%');
258257
});
259-
260258
}
261259
}
262260
});
263-
264261
}
265262

266263
return $query;

0 commit comments

Comments
 (0)