@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @var array Guarded fields |
| 31 | 31 | */ |
| 32 | - protected $guarded = ['*']; |
|
| 32 | + protected $guarded = [ '*' ]; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * @var array Fillable fields |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | public function saveBasePrice() |
| 126 | 126 | { |
| 127 | 127 | Price::updateOrCreate( |
| 128 | - ['product_id' => $this->id, 'discount_id' => null], |
|
| 129 | - ['price' => $this->base_price] |
|
| 128 | + [ 'product_id' => $this->id, 'discount_id' => null ], |
|
| 129 | + [ 'price' => $this->base_price ] |
|
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -173,21 +173,21 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public static function syncAllInheritedCategories() |
| 175 | 175 | { |
| 176 | - Queue::push(function ($job) { |
|
| 177 | - $data = []; |
|
| 176 | + Queue::push(function($job) { |
|
| 177 | + $data = [ ]; |
|
| 178 | 178 | $products = Product::with('categories')->get(); |
| 179 | 179 | $categoryTree = Category::getParentCategoryIds(); |
| 180 | 180 | |
| 181 | 181 | foreach ($products as $product) { |
| 182 | - $inheritedCategoryIds = []; |
|
| 182 | + $inheritedCategoryIds = [ ]; |
|
| 183 | 183 | foreach ($product->categories as $category) { |
| 184 | 184 | if (array_key_exists($category->id, $categoryTree)) { |
| 185 | - $inheritedCategoryIds = array_merge($inheritedCategoryIds, $categoryTree[$category->id]); |
|
| 185 | + $inheritedCategoryIds = array_merge($inheritedCategoryIds, $categoryTree[ $category->id ]); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | foreach (array_unique($inheritedCategoryIds) as $categoryId) { |
| 190 | - $data[] = [ |
|
| 190 | + $data[ ] = [ |
|
| 191 | 191 | 'category_id' => $categoryId, |
| 192 | 192 | 'product_id' => $product->id, |
| 193 | 193 | 'is_inherited' => 1, |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function syncInheritedCategories(array $categoryIds = null) |
| 212 | 212 | { |
| 213 | - $data = []; |
|
| 213 | + $data = [ ]; |
|
| 214 | 214 | $categoryIds = $this->categories()->lists('id'); |
| 215 | 215 | $parentIds = Category::isParentOf($categoryIds)->lists('id'); |
| 216 | 216 | foreach ($parentIds as $parentId) { |
| 217 | - $data[] = [ |
|
| 217 | + $data[ ] = [ |
|
| 218 | 218 | 'category_id' => $parentId, |
| 219 | 219 | 'product_id' => $this->id, |
| 220 | 220 | 'is_inherited' => true, |