@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public function createApplication() |
18 | 18 | { |
19 | - $app = require __DIR__ . '/../../../../bootstrap/app.php'; |
|
19 | + $app = require __DIR__.'/../../../../bootstrap/app.php'; |
|
20 | 20 | // $kernel = new Kernel(); |
21 | 21 | // dd($kernel); |
22 | 22 | $app->make(Kernel::class)->bootstrap(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $result = $query; |
36 | 36 | $keys = explode('.', $filters[0]['key']); |
37 | 37 | if (collect($keys)->count() == 2) { |
38 | - $result = $result->orWhereHas($keys[0], function ($query) use ($filters, $keys) { |
|
38 | + $result = $result->orWhereHas($keys[0], function($query) use ($filters, $keys) { |
|
39 | 39 | foreach ($filters as $filter) { |
40 | 40 | $keys = explode('.', $filter['key']); |
41 | 41 | $query->where($keys[1], $filter['operator'], $filter['value']); |
@@ -102,8 +102,7 @@ discard block |
||
102 | 102 | $result = $this->getHierarchyFilterKey($filter); |
103 | 103 | } |
104 | 104 | $key = $level % 2 == $this->orWhereConditionLevel ? |
105 | - 'or_' . $this->queryFilterTitle : |
|
106 | - 'and_' . $this->queryFilterTitle; |
|
105 | + 'or_'.$this->queryFilterTitle : 'and_'.$this->queryFilterTitle; |
|
107 | 106 | $adaptedFilters = array_merge_recursive($adaptedFilters, [$key => $result]); |
108 | 107 | } |
109 | 108 | return $adaptedFilters; |
@@ -154,7 +153,7 @@ discard block |
||
154 | 153 | { |
155 | 154 | foreach ($filters as $filterKey => $filterValues) { |
156 | 155 | $currentFilter = [$filterKey => $filterValues]; |
157 | - $model = $model->Where(function ($query) use ($currentFilter) { |
|
156 | + $model = $model->Where(function($query) use ($currentFilter) { |
|
158 | 157 | $this->addWhereCondition($query, $currentFilter, $this->orWhereConditionLevel == 0 ? 'and' : 'or'); |
159 | 158 | }); |
160 | 159 | } |
@@ -194,7 +193,7 @@ discard block |
||
194 | 193 | } |
195 | 194 | |
196 | 195 | // Get Inner key and value |
197 | - if (count($filters[$firstFilterKey])===1) { |
|
196 | + if (count($filters[$firstFilterKey]) === 1) { |
|
198 | 197 | break; |
199 | 198 | // return $model; |
200 | 199 | } |
@@ -202,15 +201,15 @@ discard block |
||
202 | 201 | return $this->addWhereCondition($model, $filters, $type, ++$index); |
203 | 202 | |
204 | 203 | // if and |
205 | - case 'and_' . $this->queryFilterTitle: |
|
204 | + case 'and_'.$this->queryFilterTitle: |
|
206 | 205 | // if not first record and type is or |
207 | 206 | if ($type == "or" && $index > 0) { |
208 | - $model = $model->orWhere(function (Builder $builder) use ($firstFilterValue) { |
|
207 | + $model = $model->orWhere(function(Builder $builder) use ($firstFilterValue) { |
|
209 | 208 | $builder = $this->addWhereCondition($builder, $firstFilterValue, 'and', 0); |
210 | 209 | return $builder; |
211 | 210 | }); |
212 | 211 | } else { |
213 | - $model = $model->where(function (Builder $builder) use ($firstFilterValue) { |
|
212 | + $model = $model->where(function(Builder $builder) use ($firstFilterValue) { |
|
214 | 213 | $builder = $this->addWhereCondition($builder, $firstFilterValue, 'and', 0); |
215 | 214 | return $builder; |
216 | 215 | }); |
@@ -218,15 +217,15 @@ discard block |
||
218 | 217 | break; |
219 | 218 | |
220 | 219 | // if or |
221 | - case 'or_' . $this->queryFilterTitle: |
|
220 | + case 'or_'.$this->queryFilterTitle: |
|
222 | 221 | // if not first record and type is or |
223 | 222 | if ($type == "or" && $index > 0) { |
224 | - $model = $model->orWhere(function (Builder $builder) use ($firstFilterValue) { |
|
223 | + $model = $model->orWhere(function(Builder $builder) use ($firstFilterValue) { |
|
225 | 224 | $builder = $this->addWhereCondition($builder, $firstFilterValue, 'or', 0); |
226 | 225 | return $builder; |
227 | 226 | }); |
228 | 227 | } else { |
229 | - $model = $model->where(function (Builder $builder) use ($firstFilterValue) { |
|
228 | + $model = $model->where(function(Builder $builder) use ($firstFilterValue) { |
|
230 | 229 | $builder = $this->addWhereCondition($builder, $firstFilterValue, 'or', 0); |
231 | 230 | return $builder; |
232 | 231 | }); |
@@ -237,12 +236,12 @@ discard block |
||
237 | 236 | default: |
238 | 237 | // if not first record and type is or |
239 | 238 | if ($type == "or" && $index > 0) { |
240 | - $model = $model->orWhereHas($firstFilterKey, function (Builder $builder) use ($firstFilterValue) { |
|
239 | + $model = $model->orWhereHas($firstFilterKey, function(Builder $builder) use ($firstFilterValue) { |
|
241 | 240 | $builder = $this->addWhereCondition($builder, $firstFilterValue, 'or', 0); |
242 | 241 | return $builder; |
243 | 242 | }); |
244 | 243 | } else { |
245 | - $model = $model->whereHas($firstFilterKey, function (Builder $builder) use ($firstFilterValue) { |
|
244 | + $model = $model->whereHas($firstFilterKey, function(Builder $builder) use ($firstFilterValue) { |
|
246 | 245 | $builder = $this->addWhereCondition($builder, $firstFilterValue, 'or', 0); |
247 | 246 | return $builder; |
248 | 247 | }); |