Completed
Push — master ( 69de0f...497890 )
by Scott
05:04
created
formwidgets/OptionsInventories.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
     public function prepareVars()
29 29
     {
30 30
         if ($this->model->exists) {
31
-            $this->vars['options'] = $this->model->options()->with('values')->get()->toArray();
32
-            $this->vars['inventories'] = $this->model->inventories()->get()->toArray();
31
+            $this->vars[ 'options' ] = $this->model->options()->with('values')->get()->toArray();
32
+            $this->vars[ 'inventories' ] = $this->model->inventories()->get()->toArray();
33 33
         } else {
34
-            $this->vars['options'] = [];
35
-            $this->vars['inventories'] = [];
34
+            $this->vars[ 'options' ] = [ ];
35
+            $this->vars[ 'inventories' ] = [ ];
36 36
         }
37 37
     }
38 38
 
Please login to merge, or discard this patch.
models/Option.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     /**
16 16
      * @var array Guarded fields
17 17
      */
18
-    protected $guarded = ['*'];
18
+    protected $guarded = [ '*' ];
19 19
 
20 20
     /**
21 21
      * @var array Fillable fields
Please login to merge, or discard this patch.
models/OptionValue.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     /**
16 16
      * @var array Guarded fields
17 17
      */
18
-    protected $guarded = ['*'];
18
+    protected $guarded = [ '*' ];
19 19
 
20 20
     /**
21 21
      * @var array Fillable fields
Please login to merge, or discard this patch.
models/Product.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     /**
33 33
      * @var array Guarded fields
34 34
      */
35
-    protected $guarded = ['*'];
35
+    protected $guarded = [ '*' ];
36 36
 
37 37
     /**
38 38
      * @var array Fillable fields
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
     public function saveBasePrice()
140 140
     {
141 141
         Price::updateOrCreate(
142
-            ['product_id' => $this->id, 'discount_id' => null],
143
-            ['price' => $this->base_price]
142
+            [ 'product_id' => $this->id, 'discount_id' => null ],
143
+            [ 'price' => $this->base_price ]
144 144
         );
145 145
     }
146 146
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
     {
170 170
         $data = $this->getOriginalPurgeValue('optionsInventories');
171 171
 
172
-        if (is_array($data['options'])) {
173
-            $options = $this->saveRelatedOptions($data['options']);
172
+        if (is_array($data[ 'options' ])) {
173
+            $options = $this->saveRelatedOptions($data[ 'options' ]);
174 174
         }
175 175
     }
176 176
 
@@ -182,18 +182,18 @@  discard block
 block discarded – undo
182 182
      */
183 183
     protected function saveRelatedOptions(array $options) {
184 184
         foreach ($options as &$option) {
185
-            $model = $option['id'] !== null
186
-                ? Option::firstOrNew(['id' => $option['id']])
185
+            $model = $option[ 'id' ] !== null
186
+                ? Option::firstOrNew([ 'id' => $option[ 'id' ] ])
187 187
                 : new Option;
188 188
 
189 189
             $model->product_id = $this->id;
190 190
             $model->fill($option);
191 191
             $model->save();
192 192
 
193
-            $option['id'] = $model->id;
193
+            $option[ 'id' ] = $model->id;
194 194
 
195
-            if (is_array($option['values'])) {
196
-                $this->saveRelatedOptionValues($model, $option['values']);
195
+            if (is_array($option[ 'values' ])) {
196
+                $this->saveRelatedOptionValues($model, $option[ 'values' ]);
197 197
             }
198 198
         }
199 199
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
      */
210 210
     protected function saveRelatedOptionValues(Option $option, array $values) {
211 211
         foreach ($values as $value) {
212
-            $model = $value['id'] !== null
213
-                ? OptionValue::firstOrNew(['id' => $value['id']])
212
+            $model = $value[ 'id' ] !== null
213
+                ? OptionValue::firstOrNew([ 'id' => $value[ 'id' ] ])
214 214
                 : new OptionValue;
215 215
 
216 216
             $model->option_id = $option->id;
@@ -247,21 +247,21 @@  discard block
 block discarded – undo
247 247
      */
248 248
     public static function syncAllInheritedCategories()
249 249
     {
250
-        Queue::push(function ($job) {
251
-            $data = [];
250
+        Queue::push(function($job) {
251
+            $data = [ ];
252 252
             $products = Product::with('categories')->get();
253 253
             $categoryTree = Category::getParentCategoryIds();
254 254
 
255 255
             foreach ($products as $product) {
256
-                $inheritedCategoryIds = [];
256
+                $inheritedCategoryIds = [ ];
257 257
                 foreach ($product->categories as $category) {
258 258
                     if (array_key_exists($category->id, $categoryTree)) {
259
-                        $inheritedCategoryIds = array_merge($inheritedCategoryIds, $categoryTree[$category->id]);
259
+                        $inheritedCategoryIds = array_merge($inheritedCategoryIds, $categoryTree[ $category->id ]);
260 260
                     }
261 261
                 }
262 262
 
263 263
                 foreach (array_unique($inheritedCategoryIds) as $categoryId) {
264
-                    $data[] = [
264
+                    $data[ ] = [
265 265
                         'category_id' => $categoryId,
266 266
                         'product_id' => $product->id,
267 267
                         'is_inherited' => 1,
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
      */
285 285
     public function syncInheritedCategories()
286 286
     {
287
-        $data = [];
287
+        $data = [ ];
288 288
         $categoryIds = $this->categories()->lists('id');
289 289
         $parentIds = Category::isParentOf($categoryIds)->lists('id');
290 290
         foreach ($parentIds as $parentId) {
291
-            $data[] = [
291
+            $data[ ] = [
292 292
                 'category_id' => $parentId,
293 293
                 'product_id' => $this->id,
294 294
                 'is_inherited' => true,
Please login to merge, or discard this patch.
controllers/Categories.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     /**
66 66
      * Override the default list delete behavior.
67 67
      *
68
-     * @param  \Bedard\Shop\Models\Category $category
68
+     * @param  \Bedard\Shop\Models\Category $catgory
69 69
      * @return void
70 70
      */
71 71
     public function overrideListDelete(Category $catgory)
Please login to merge, or discard this patch.
models/Discount.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     /**
44 44
      * @var array Guarded fields
45 45
      */
46
-    protected $guarded = ['*'];
46
+    protected $guarded = [ '*' ];
47 47
 
48 48
     /**
49 49
      * @var array Fillable fields
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
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,14 +168,14 @@  discard block
 block discarded – undo
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
-            }])
174
-            ->get(['id']);
173
+            } ])
174
+            ->get([ 'id' ]);
175 175
 
176 176
         foreach ($categories as $category) {
177 177
             foreach ($category->products as $product) {
178
-                $productIds[] = $product->id;
178
+                $productIds[ ] = $product->id;
179 179
             }
180 180
         }
181 181
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      */
235 235
     public static function syncAllPrices()
236 236
     {
237
-        $data = [];
237
+        $data = [ ];
238 238
         $discounts = self::isNotExpired()->with('categories.products', 'products')->get();
239 239
         foreach ($discounts as $discount) {
240 240
             $products = $discount->products;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             }
244 244
 
245 245
             foreach ($products as $product) {
246
-                $data[] = self::buildPriceArray($discount, $product);
246
+                $data[ ] = self::buildPriceArray($discount, $product);
247 247
             }
248 248
         }
249 249
 
@@ -261,17 +261,17 @@  discard block
 block discarded – undo
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();
271 271
 
272
-        $data = [];
272
+        $data = [ ];
273 273
         foreach ($discounts as $discount) {
274
-            $data[] = self::buildPriceArray($discount, $product);
274
+            $data[ ] = self::buildPriceArray($discount, $product);
275 275
         }
276 276
 
277 277
         Price::whereProductId($product->id)->whereNotNull('discount_id')->delete();
Please login to merge, or discard this patch.