@@ -91,11 +91,11 @@ |
||
| 91 | 91 | */ |
| 92 | 92 | public function scopeHasOptionValueIds($query, $ids) |
| 93 | 93 | { |
| 94 | - if (! is_array($ids)) { |
|
| 94 | + if (!is_array($ids)) { |
|
| 95 | 95 | $ids = [$ids]; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - return $query->whereHas('optionValues', function ($optionValue) use ($ids) { |
|
| 98 | + return $query->whereHas('optionValues', function($optionValue) use ($ids) { |
|
| 99 | 99 | return $optionValue->whereIn('id', $ids); |
| 100 | 100 | }); |
| 101 | 101 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function up() |
| 10 | 10 | { |
| 11 | - Schema::create('bedard_shop_filters', function (Blueprint $table) { |
|
| 11 | + Schema::create('bedard_shop_filters', function(Blueprint $table) { |
|
| 12 | 12 | $table->engine = 'InnoDB'; |
| 13 | 13 | $table->increments('id'); |
| 14 | 14 | $table->integer('category_id')->unsigned()->index(); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | public function validate() |
| 19 | 19 | { |
| 20 | 20 | $data = input('option'); |
| 21 | - if (! $data || ! is_array($data)) { |
|
| 21 | + if (!$data || !is_array($data)) { |
|
| 22 | 22 | return Response::make('Error', 422); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -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 | |
@@ -167,12 +167,12 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | protected function deleteRelatedInventories($inventories) |
| 169 | 169 | { |
| 170 | - return array_filter($inventories, function ($inventory) { |
|
| 170 | + return array_filter($inventories, function($inventory) { |
|
| 171 | 171 | if ($inventory['id'] !== null && $inventory['is_deleted']) { |
| 172 | 172 | Inventory::find($inventory['id'])->delete(); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - return ! $inventory['is_deleted']; |
|
| 175 | + return !$inventory['is_deleted']; |
|
| 176 | 176 | }); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | protected function deleteRelatedOptions(array $options) |
| 186 | 186 | { |
| 187 | - return array_filter($options, function ($option) { |
|
| 187 | + return array_filter($options, function($option) { |
|
| 188 | 188 | if ($option['id'] !== null && $option['is_deleted']) { |
| 189 | 189 | Option::find($option['id'])->delete(); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - return ! $option['is_deleted']; |
|
| 192 | + return !$option['is_deleted']; |
|
| 193 | 193 | }); |
| 194 | 194 | } |
| 195 | 195 | |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | protected function deleteRelatedOptionValues(array $optionValues) |
| 203 | 203 | { |
| 204 | - return array_filter($optionValues, function ($optionValue) { |
|
| 204 | + return array_filter($optionValues, function($optionValue) { |
|
| 205 | 205 | if ($optionValue['id'] !== null && $optionValue['is_deleted']) { |
| 206 | 206 | OptionValue::find($optionValue['id'])->delete(); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - return ! $optionValue['is_deleted']; |
|
| 209 | + return !$optionValue['is_deleted']; |
|
| 210 | 210 | }); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * @param string $sessionKey |
| 339 | 339 | * @return void |
| 340 | 340 | */ |
| 341 | - protected function saveRelatedOptionValues(Option &$option, array $values, $sessionKey) |
|
| 341 | + protected function saveRelatedOptionValues(Option & $option, array $values, $sessionKey) |
|
| 342 | 342 | { |
| 343 | 343 | foreach ($values as $index => $value) { |
| 344 | 344 | $model = array_key_exists('id', $value) && $value['id'] !== null |
@@ -362,10 +362,10 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | public function scopeAppearingInCategory(Builder $query, $categoryId) |
| 364 | 364 | { |
| 365 | - return $query->where(function ($q) use ($categoryId) { |
|
| 366 | - return $q->whereHas('categories', function ($category) use ($categoryId) { |
|
| 365 | + return $query->where(function($q) use ($categoryId) { |
|
| 366 | + return $q->whereHas('categories', function($category) use ($categoryId) { |
|
| 367 | 367 | $category->whereId($categoryId); |
| 368 | - })->orWhereHas('inherited_categories', function ($category) use ($categoryId) { |
|
| 368 | + })->orWhereHas('inherited_categories', function($category) use ($categoryId) { |
|
| 369 | 369 | $category->whereId($categoryId); |
| 370 | 370 | }); |
| 371 | 371 | }); |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | public static function syncAllInheritedCategories() |
| 483 | 483 | { |
| 484 | - Queue::push(function ($job) { |
|
| 484 | + Queue::push(function($job) { |
|
| 485 | 485 | $data = []; |
| 486 | 486 | $products = Product::with('categories')->get(); |
| 487 | 487 | $categoryTree = Category::getParentCategoryIds(); |
@@ -544,8 +544,8 @@ discard block |
||
| 544 | 544 | */ |
| 545 | 545 | protected function validateInventories() |
| 546 | 546 | { |
| 547 | - if (! is_array($this->optionsInventories) || |
|
| 548 | - ! is_array($this->optionsInventories['options'])) { |
|
| 547 | + if (!is_array($this->optionsInventories) || |
|
| 548 | + !is_array($this->optionsInventories['options'])) { |
|
| 549 | 549 | return; |
| 550 | 550 | } |
| 551 | 551 | |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | sort($inventory['valueIds']); |
| 560 | 560 | $valueCombination = json_encode($inventory['valueIds']); |
| 561 | 561 | |
| 562 | - if (in_array($valueCombination, $takenValueCombinations) && ! $inventory['is_deleted']) { |
|
| 562 | + if (in_array($valueCombination, $takenValueCombinations) && !$inventory['is_deleted']) { |
|
| 563 | 563 | Flash::error(Lang::get('bedard.shop::lang.products.form.duplicate_inventories_error')); |
| 564 | 564 | throw new ModelException($this); |
| 565 | 565 | } |
@@ -576,8 +576,8 @@ discard block |
||
| 576 | 576 | */ |
| 577 | 577 | protected function validateOptions() |
| 578 | 578 | { |
| 579 | - if (! is_array($this->optionsInventories) || |
|
| 580 | - ! is_array($this->optionsInventories['options'])) { |
|
| 579 | + if (!is_array($this->optionsInventories) || |
|
| 580 | + !is_array($this->optionsInventories['options'])) { |
|
| 581 | 581 | return; |
| 582 | 582 | } |
| 583 | 583 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $this->syncInheritedProductsAfterSave(); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - protected function applyCustomOrder(Builder &$products) |
|
| 139 | + protected function applyCustomOrder(Builder & $products) |
|
| 140 | 140 | { |
| 141 | 141 | $customOrder = ""; |
| 142 | 142 | foreach ($this->product_order as $index => $id) { |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | * @param \October\Rain\Database\Builder $products |
| 153 | 153 | * @return void |
| 154 | 154 | */ |
| 155 | - protected function applyProductFilters(Builder &$products) |
|
| 155 | + protected function applyProductFilters(Builder & $products) |
|
| 156 | 156 | { |
| 157 | - $products->where(function ($query) { |
|
| 157 | + $products->where(function($query) { |
|
| 158 | 158 | foreach ($this->filters as $filter) { |
| 159 | 159 | $right = $filter->getRightClause(); |
| 160 | 160 | $query->where($filter->left, $filter->comparator, $right); |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | protected function deleteRelatedFilters(array $filters) |
| 184 | 184 | { |
| 185 | - return array_filter($filters, function ($filter) { |
|
| 185 | + return array_filter($filters, function($filter) { |
|
| 186 | 186 | if ($filter['id'] !== null && $filter['is_deleted']) { |
| 187 | 187 | Filter::find($filter['id'])->delete(); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - return ! $filter['is_deleted']; |
|
| 190 | + return !$filter['is_deleted']; |
|
| 191 | 191 | }); |
| 192 | 192 | } |
| 193 | 193 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | public static function getParentIds($children, \October\Rain\Database\Collection $categories = null) |
| 239 | 239 | { |
| 240 | - if (! is_array($children)) { |
|
| 240 | + if (!is_array($children)) { |
|
| 241 | 241 | $children = [$children]; |
| 242 | 242 | } |
| 243 | 243 | |
@@ -247,13 +247,13 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | $parents = []; |
| 249 | 249 | foreach ($children as $child) { |
| 250 | - $category = $categories->filter(function ($model) use ($child) { |
|
| 250 | + $category = $categories->filter(function($model) use ($child) { |
|
| 251 | 251 | return $model->id == $child; |
| 252 | 252 | })->first(); |
| 253 | 253 | |
| 254 | 254 | while ($category && $category->parent_id) { |
| 255 | 255 | $parents[] = $category->parent_id; |
| 256 | - $category = $categories->filter(function ($model) use ($category) { |
|
| 256 | + $category = $categories->filter(function($model) use ($category) { |
|
| 257 | 257 | return $model->id == $category->parent_id; |
| 258 | 258 | })->first(); |
| 259 | 259 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | */ |
| 325 | 325 | public function isCustomSorted() |
| 326 | 326 | { |
| 327 | - return ! $this->product_sort_column && ! $this->product_sort_direction; |
|
| 327 | + return !$this->product_sort_column && !$this->product_sort_direction; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | { |
| 347 | 347 | $filters = $this->getOriginalPurgeValue('category_filters'); |
| 348 | 348 | |
| 349 | - if (is_array($filters) && ! empty($filters)) { |
|
| 349 | + if (is_array($filters) && !empty($filters)) { |
|
| 350 | 350 | $filters = $this->deleteRelatedFilters($filters); |
| 351 | 351 | $this->saveRelatedFilters($filters); |
| 352 | 352 | } |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | protected function setNullParentId() |
| 450 | 450 | { |
| 451 | - if (! $this->parent_id) { |
|
| 451 | + if (!$this->parent_id) { |
|
| 452 | 452 | $this->parent_id = null; |
| 453 | 453 | } |
| 454 | 454 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | */ |
| 490 | 490 | public function syncInheritedProductsAfterDelete() |
| 491 | 491 | { |
| 492 | - if (! $this->dontSyncAfterDelete) { |
|
| 492 | + if (!$this->dontSyncAfterDelete) { |
|
| 493 | 493 | Product::syncAllInheritedCategories(); |
| 494 | 494 | } |
| 495 | 495 | } |