@@ -141,7 +141,6 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * Apply filters to a products query. |
| 143 | 143 | * |
| 144 | - * @param \October\Rain\Database\Builder $query |
|
| 145 | 144 | * @return void |
| 146 | 145 | */ |
| 147 | 146 | protected function applyProductFilters(Builder &$products) |
@@ -239,6 +238,9 @@ discard block |
||
| 239 | 238 | return $children; |
| 240 | 239 | } |
| 241 | 240 | |
| 241 | + /** |
|
| 242 | + * @param integer $children |
|
| 243 | + */ |
|
| 242 | 244 | public static function getParentIds($children, \October\Rain\Database\Collection $categories = null) |
| 243 | 245 | { |
| 244 | 246 | if (! is_array($children)) { |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | * @param \October\Rain\Database\Builder $query |
| 145 | 145 | * @return void |
| 146 | 146 | */ |
| 147 | - protected function applyProductFilters(Builder &$products) |
|
| 147 | + protected function applyProductFilters(Builder & $products) |
|
| 148 | 148 | { |
| 149 | - $products->where(function ($query) { |
|
| 149 | + $products->where(function($query) { |
|
| 150 | 150 | foreach ($this->filters as $filter) { |
| 151 | 151 | // price filters |
| 152 | 152 | if ($filter->left === 'base_price' || $filter->left === 'price') { |
@@ -186,12 +186,12 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | protected function deleteRelatedFilters(array $filters) |
| 188 | 188 | { |
| 189 | - return array_filter($filters, function ($filter) { |
|
| 189 | + return array_filter($filters, function($filter) { |
|
| 190 | 190 | if ($filter['id'] !== null && $filter['is_deleted']) { |
| 191 | 191 | Filter::find($filter['id'])->delete(); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - return ! $filter['is_deleted']; |
|
| 194 | + return !$filter['is_deleted']; |
|
| 195 | 195 | }); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | public static function getParentIds($children, \October\Rain\Database\Collection $categories = null) |
| 243 | 243 | { |
| 244 | - if (! is_array($children)) { |
|
| 244 | + if (!is_array($children)) { |
|
| 245 | 245 | $children = [$children]; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | $parents = []; |
| 253 | 253 | foreach ($children as $child) { |
| 254 | - $category = $categories->filter(function ($model) use ($child) { |
|
| 254 | + $category = $categories->filter(function($model) use ($child) { |
|
| 255 | 255 | return $model->id == $child; |
| 256 | 256 | })->first(); |
| 257 | 257 | |
| 258 | 258 | while ($category && $category->parent_id) { |
| 259 | 259 | $parents[] = $category->parent_id; |
| 260 | - $category = $categories->filter(function ($model) use ($category) { |
|
| 260 | + $category = $categories->filter(function($model) use ($category) { |
|
| 261 | 261 | return $model->id == $category->parent_id; |
| 262 | 262 | })->first(); |
| 263 | 263 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | public function isCustomSorted() |
| 320 | 320 | { |
| 321 | - return ! $this->product_sort_column && ! $this->product_sort_direction; |
|
| 321 | + return !$this->product_sort_column && !$this->product_sort_direction; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | { |
| 341 | 341 | $filters = $this->getOriginalPurgeValue('category_filters'); |
| 342 | 342 | |
| 343 | - if (is_array($filters) && ! empty($filters)) { |
|
| 343 | + if (is_array($filters) && !empty($filters)) { |
|
| 344 | 344 | $filters = $this->deleteRelatedFilters($filters); |
| 345 | 345 | $this->saveRelatedFilters($filters); |
| 346 | 346 | } |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | */ |
| 443 | 443 | protected function setNullParentId() |
| 444 | 444 | { |
| 445 | - if (! $this->parent_id) { |
|
| 445 | + if (!$this->parent_id) { |
|
| 446 | 446 | $this->parent_id = null; |
| 447 | 447 | } |
| 448 | 448 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | public function syncInheritedProductsAfterDelete() |
| 485 | 485 | { |
| 486 | - if (! $this->dontSyncAfterDelete) { |
|
| 486 | + if (!$this->dontSyncAfterDelete) { |
|
| 487 | 487 | Product::syncAllInheritedCategories(); |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | { |
| 15 | 15 | $query = Category::isActive(); |
| 16 | 16 | |
| 17 | - if (array_key_exists('select', $params) && is_array($params['select']) && ! empty($params['select'])) { |
|
| 17 | + if (array_key_exists('select', $params) && is_array($params['select']) && !empty($params['select'])) { |
|
| 18 | 18 | $query->select($params['select']); |
| 19 | 19 | } |
| 20 | 20 | |