Skip to content

Commit 8187cf9

Browse files
committed
2 parents 485ca08 + a047b01 commit 8187cf9

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

config/query-filters.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
| You can also override per model via $globalSearchKey property.
2121
|
2222
*/
23-
'global_key' => 'q',
23+
'global_key' => 'q',
2424

2525
/*
2626
|--------------------------------------------------------------------------
@@ -58,7 +58,16 @@
5858
| defining a public $allowedFilters = ['...'] property.
5959
|
6060
*/
61+
<<<<<<< HEAD
6162
'allowed_filters' => ['*'],
63+
=======
64+
'allowed_filters' => [
65+
// 'status',
66+
// 'role',
67+
// 'email',
68+
// 'created_at',
69+
],
70+
>>>>>>> a047b0140be224c9fd3cec5da35f95c29930c5e7
6271

6372
/*
6473
|--------------------------------------------------------------------------
@@ -75,7 +84,7 @@
7584
| /users?name=John&mode=like => partial match if mode is changed
7685
|
7786
*/
78-
'default_match' => 'exact',
87+
'default_match' => 'exact',
7988

8089
/*
8190
|--------------------------------------------------------------------------
@@ -95,7 +104,7 @@
95104
| 'user.*' => 'like' // wildcard on all user columns
96105
|
97106
*/
98-
'filter_modes' => [
107+
'filter_modes' => [
99108
// 'email' => 'strict',
100109
// 'name' => 'like',
101110
// 'user.*' => 'like',
@@ -114,8 +123,13 @@
114123
| Config fallback if none specified
115124
|
116125
*/
126+
<<<<<<< HEAD
117127
'pagination' => [
118128
'per_page' => 10, // default items per page
129+
=======
130+
'pagination' => [
131+
'per_page' => 10, // default items per page
132+
>>>>>>> a047b0140be224c9fd3cec5da35f95c29930c5e7
119133
'max_per_page' => 100, // maximum items allowed per page
120134
],
121135

@@ -133,9 +147,9 @@
133147
| 'allowed_columns' => ['name', 'created_at']
134148
|
135149
*/
136-
'sorting' => [
150+
'sorting' => [
137151
'allowed_columns' => [], // empty = all allowed
138-
'default' => null, // e.g., 'created_at' or '-created_at'
152+
'default' => null, // e.g., 'created_at' or '-created_at'
139153
],
140154

141155
/*
@@ -155,7 +169,7 @@
155169
| Disable by setting 'enabled' => false
156170
|
157171
*/
158-
'operators' => [
172+
'operators' => [
159173
'enabled' => true,
160174
],
161175

src/Concerns/HandlesGlobalSearch.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Obrainwave\LaravelQueryFilters\Concerns;
34

45
trait HandlesGlobalSearch
@@ -20,8 +21,8 @@ protected function getGlobalSearchKey(): string
2021

2122
protected function applyGlobalSearch(string $term): void
2223
{
23-
$term = strtolower($term);
24-
$model = $this->builder->getModel();
24+
$term = strtolower($term);
25+
$model = $this->builder->getModel();
2526
$allColumns = \Schema::getColumnListing($model->getTable());
2627

2728
if ($model && method_exists($model, 'getGlobalSearchColumns')) {
@@ -38,7 +39,7 @@ protected function applyGlobalSearch(string $term): void
3839
['name', 'title', 'content', 'body', 'message', 'subject'],
3940
$allColumns
4041
);
41-
42+
4243
}
4344

4445
$strict = config('queryfilters.strict_global_search', false);
@@ -62,5 +63,4 @@ protected function applyGlobalSearch(string $term): void
6263
});
6364
}
6465
}
65-
6666
}

0 commit comments

Comments
 (0)