@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | $filterable = $this->getFilterable(); |
| 23 | 23 | $attributes = $this->getFilterAttributes($filterAttributes); |
| 24 | 24 | |
| 25 | - if (! empty($attributes)) { |
|
| 26 | - $query->where(function ($q) use ($attributes, $filterable) { |
|
| 25 | + if (!empty($attributes)) { |
|
| 26 | + $query->where(function($q) use ($attributes, $filterable) { |
|
| 27 | 27 | foreach ($filterable as $key => $filterType) { |
| 28 | 28 | switch ($filterType) { |
| 29 | 29 | case 'equal': |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $requestKeyName = config('filterable.input_keys.filter', 'filter'); |
| 112 | 112 | |
| 113 | - if (! empty($attributes)) { |
|
| 113 | + if (!empty($attributes)) { |
|
| 114 | 114 | return $attributes; |
| 115 | 115 | } elseif ($requestKeyName && request($requestKeyName) && is_array(request($requestKeyName))) { |
| 116 | 116 | return request($requestKeyName); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $has = preg_replace("/\.\w+$/", '', $key); |
| 135 | 135 | $key = preg_replace("/\w+\./", '', $key); |
| 136 | 136 | |
| 137 | - $q->whereHas($has, function ($qq) use ($key, $value) { |
|
| 137 | + $q->whereHas($has, function($qq) use ($key, $value) { |
|
| 138 | 138 | $qq->where($key, $value); |
| 139 | 139 | }); |
| 140 | 140 | } else { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $has = preg_replace("/\.\w+$/", '', $key); |
| 172 | 172 | $key = preg_replace("/\w+\./", '', $key); |
| 173 | 173 | |
| 174 | - $q->whereHas($has, function ($qq) use ($key, $value) { |
|
| 174 | + $q->whereHas($has, function($qq) use ($key, $value) { |
|
| 175 | 175 | $qq->whereIn($key, $value); |
| 176 | 176 | }); |
| 177 | 177 | } else { |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | $search = $this->getSearchStr($search); |
| 193 | 193 | |
| 194 | - $query->when($search !== null, function () use ($query, $search) { |
|
| 195 | - $query->where(function ($query2) use ($search) { |
|
| 194 | + $query->when($search !== null, function() use ($query, $search) { |
|
| 195 | + $query->where(function($query2) use ($search) { |
|
| 196 | 196 | foreach ($this->getSearchable() as $key) { |
| 197 | 197 | if (preg_match('/\./', $key)) { |
| 198 | 198 | $has = preg_replace("/\.\w+$/", '', $key); |
| 199 | 199 | $key = preg_replace("/\w+\./", '', $key); |
| 200 | - $query2->orWhereHas($has, function ($qq) use ($key, $search) { |
|
| 200 | + $query2->orWhereHas($has, function($qq) use ($key, $search) { |
|
| 201 | 201 | $qq->where($key, 'LIKE', "%$search%"); |
| 202 | 202 | }); |
| 203 | 203 | } else { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | public function boot() |
| 13 | 13 | { |
| 14 | 14 | $this->publishes([ |
| 15 | - __DIR__.'/../config/filterable.php' => config_path('filterable.php') |
|
| 15 | + __DIR__ . '/../config/filterable.php' => config_path('filterable.php') |
|
| 16 | 16 | ], 'config'); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -23,6 +23,6 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function register() |
| 25 | 25 | { |
| 26 | - $this->mergeConfigFrom(__DIR__.'/../config/filterable.php', 'filterable'); |
|
| 26 | + $this->mergeConfigFrom(__DIR__ . '/../config/filterable.php', 'filterable'); |
|
| 27 | 27 | } |
| 28 | 28 | } |