@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function up() |
| 10 | 10 | { |
| 11 | - Schema::create('bedard_shop_category_discount', function (Blueprint $table) { |
|
| 11 | + Schema::create('bedard_shop_category_discount', function(Blueprint $table) { |
|
| 12 | 12 | $table->engine = 'InnoDB'; |
| 13 | 13 | $table->integer('category_id')->unsigned()->nullable(); |
| 14 | 14 | $table->integer('discount_id')->unsigned()->nullable(); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function up() |
| 10 | 10 | { |
| 11 | - Schema::create('bedard_shop_category_product', function (Blueprint $table) { |
|
| 11 | + Schema::create('bedard_shop_category_product', function(Blueprint $table) { |
|
| 12 | 12 | $table->engine = 'InnoDB'; |
| 13 | 13 | $table->integer('category_id')->unsigned()->nullable(); |
| 14 | 14 | $table->integer('product_id')->unsigned()->nullable(); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function up() |
| 10 | 10 | { |
| 11 | - Schema::create('bedard_shop_inventory_option', function (Blueprint $table) { |
|
| 11 | + Schema::create('bedard_shop_inventory_option', function(Blueprint $table) { |
|
| 12 | 12 | $table->engine = 'InnoDB'; |
| 13 | 13 | $table->integer('inventory_id')->unsigned()->nullable(); |
| 14 | 14 | $table->integer('option_id')->unsigned()->index(); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function up() |
| 10 | 10 | { |
| 11 | - Schema::create('bedard_shop_discount_product', function (Blueprint $table) { |
|
| 11 | + Schema::create('bedard_shop_discount_product', function(Blueprint $table) { |
|
| 12 | 12 | $table->engine = 'InnoDB'; |
| 13 | 13 | $table->integer('discount_id')->unsigned()->nullable(); |
| 14 | 14 | $table->integer('product_id')->unsigned()->nullable(); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | public static function getParentIds($children, \October\Rain\Database\Collection $categories = null) |
| 155 | 155 | { |
| 156 | - if (! is_array($children)) { |
|
| 156 | + if (!is_array($children)) { |
|
| 157 | 157 | $children = [$children]; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -163,13 +163,13 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $parents = []; |
| 165 | 165 | foreach ($children as $child) { |
| 166 | - $category = $categories->filter(function ($model) use ($child) { |
|
| 166 | + $category = $categories->filter(function($model) use ($child) { |
|
| 167 | 167 | return $model->id == $child; |
| 168 | 168 | })->first(); |
| 169 | 169 | |
| 170 | 170 | while ($category && $category->parent_id) { |
| 171 | 171 | $parents[] = $category->parent_id; |
| 172 | - $category = $categories->filter(function ($model) use ($category) { |
|
| 172 | + $category = $categories->filter(function($model) use ($category) { |
|
| 173 | 173 | return $model->id == $category->parent_id; |
| 174 | 174 | })->first(); |
| 175 | 175 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function setNullParentId() |
| 251 | 251 | { |
| 252 | - if (! $this->parent_id) { |
|
| 252 | + if (!$this->parent_id) { |
|
| 253 | 253 | $this->parent_id = null; |
| 254 | 254 | } |
| 255 | 255 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function syncInheritedProductsAfterDelete() |
| 273 | 273 | { |
| 274 | - if (! $this->dontSyncAfterDelete) { |
|
| 274 | + if (!$this->dontSyncAfterDelete) { |
|
| 275 | 275 | Product::syncAllInheritedCategories(); |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function filterFields($fields) |
| 157 | 157 | { |
| 158 | 158 | $fields->amount_exact->hidden = $this->is_percentage; |
| 159 | - $fields->amount_percentage->hidden = ! $this->is_percentage; |
|
| 159 | + $fields->amount_percentage->hidden = !$this->is_percentage; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | $productIds = $this->products()->lists('id'); |
| 170 | 170 | $categories = $this->categories() |
| 171 | - ->with(['products' => function ($product) { |
|
| 171 | + ->with(['products' => function($product) { |
|
| 172 | 172 | return $product->select('id'); |
| 173 | 173 | }]) |
| 174 | 174 | ->get(['id']); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function getAmountExactAttribute() |
| 191 | 191 | { |
| 192 | - return ! $this->is_percentage ? $this->amount : 0; |
|
| 192 | + return !$this->is_percentage ? $this->amount : 0; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | public function savePrices() |
| 211 | 211 | { |
| 212 | 212 | $id = $this->id; |
| 213 | - Queue::push(function ($job) use ($id) { |
|
| 213 | + Queue::push(function($job) use ($id) { |
|
| 214 | 214 | $discount = Discount::findOrFail($id); |
| 215 | 215 | $productIds = $discount->getAllProductIds(); |
| 216 | 216 | $products = Product::whereIn('id', $productIds)->select('id', 'base_price')->get(); |
@@ -261,10 +261,10 @@ discard block |
||
| 261 | 261 | public static function syncProductPrice(Product $product, array $categoryIds) |
| 262 | 262 | { |
| 263 | 263 | $discounts = self::isNotExpired() |
| 264 | - ->whereHas('products', function ($query) use ($product) { |
|
| 264 | + ->whereHas('products', function($query) use ($product) { |
|
| 265 | 265 | return $query->where('id', $product->id); |
| 266 | 266 | }) |
| 267 | - ->orWhereHas('categories', function ($query) use ($categoryIds) { |
|
| 267 | + ->orWhereHas('categories', function($query) use ($categoryIds) { |
|
| 268 | 268 | return $query->whereIn('id', $categoryIds); |
| 269 | 269 | }) |
| 270 | 270 | ->get(); |
@@ -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 @@ discard block |
||
| 14 | 14 | public function createValue() |
| 15 | 15 | { |
| 16 | 16 | $data = input('value'); |
| 17 | - if (! $data || ! is_array($data)) { |
|
| 17 | + if (!$data || !is_array($data)) { |
|
| 18 | 18 | return Response::make('Error', 422); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function validate() |
| 39 | 39 | { |
| 40 | 40 | $data = input('option'); |
| 41 | - if (! $data || ! is_array($data)) { |
|
| 41 | + if (!$data || !is_array($data)) { |
|
| 42 | 42 | return Response::make('Error', 422); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -132,12 +132,12 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | protected function deleteRelatedInventories($inventories) |
| 134 | 134 | { |
| 135 | - return array_filter($inventories, function ($inventory) { |
|
| 135 | + return array_filter($inventories, function($inventory) { |
|
| 136 | 136 | if ($inventory['id'] !== null && $inventory['is_deleted']) { |
| 137 | 137 | Inventory::find($inventory['id'])->delete(); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - return ! $inventory['is_deleted']; |
|
| 140 | + return !$inventory['is_deleted']; |
|
| 141 | 141 | }); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | protected function deleteRelatedOptions($options) |
| 151 | 151 | { |
| 152 | - return array_filter($options, function ($option) { |
|
| 152 | + return array_filter($options, function($option) { |
|
| 153 | 153 | if ($option['id'] !== null && $option['is_deleted']) { |
| 154 | 154 | Option::find($option['id'])->delete(); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - return ! $option['is_deleted']; |
|
| 157 | + return !$option['is_deleted']; |
|
| 158 | 158 | }); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * @param string $sessionKey |
| 276 | 276 | * @return void |
| 277 | 277 | */ |
| 278 | - protected function saveRelatedOptionValues(Option &$option, array $values, $sessionKey) |
|
| 278 | + protected function saveRelatedOptionValues(Option & $option, array $values, $sessionKey) |
|
| 279 | 279 | { |
| 280 | 280 | foreach ($values as $value) { |
| 281 | 281 | $model = $value['id'] !== null |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public static function syncAllInheritedCategories() |
| 319 | 319 | { |
| 320 | - Queue::push(function ($job) { |
|
| 320 | + Queue::push(function($job) { |
|
| 321 | 321 | $data = []; |
| 322 | 322 | $products = Product::with('categories')->get(); |
| 323 | 323 | $categoryTree = Category::getParentCategoryIds(); |
@@ -380,8 +380,8 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | protected function validateInventories() |
| 382 | 382 | { |
| 383 | - if (! is_array($this->optionsInventories) || |
|
| 384 | - ! is_array($this->optionsInventories['options'])) { |
|
| 383 | + if (!is_array($this->optionsInventories) || |
|
| 384 | + !is_array($this->optionsInventories['options'])) { |
|
| 385 | 385 | return; |
| 386 | 386 | } |
| 387 | 387 | |
@@ -412,8 +412,8 @@ discard block |
||
| 412 | 412 | */ |
| 413 | 413 | protected function validateOptions() |
| 414 | 414 | { |
| 415 | - if (! is_array($this->optionsInventories) || |
|
| 416 | - ! is_array($this->optionsInventories['options'])) { |
|
| 415 | + if (!is_array($this->optionsInventories) || |
|
| 416 | + !is_array($this->optionsInventories['options'])) { |
|
| 417 | 417 | return; |
| 418 | 418 | } |
| 419 | 419 | |