Completed
Push — master ( 69de0f...497890 )
by Scott
05:04
created
models/Price.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.
updates/1.0/create_prices_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function up()
10 10
     {
11
-        Schema::create('bedard_shop_prices', function (Blueprint $table) {
11
+        Schema::create('bedard_shop_prices', function(Blueprint $table) {
12 12
             $table->engine = 'InnoDB';
13 13
             $table->increments('id');
14 14
             $table->decimal('price', 10, 2)->unsigned();
Please login to merge, or discard this patch.
traits/Timeable.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public static function bootTimeable()
14 14
     {
15
-        static::extend(function ($model) {
15
+        static::extend(function($model) {
16 16
             $model->addFillable('start_at', 'end_at');
17 17
             $model->addDateAttribute('start_at');
18 18
             $model->addDateAttribute('end_at');
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function scopeIsActive(Builder $query)
29 29
     {
30
-        return $query->where(function ($model) {
30
+        return $query->where(function($model) {
31 31
             return $model->isNotExpired()->isNotUpcoming();
32 32
         });
33 33
     }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function scopeIsExpired(Builder $query)
42 42
     {
43
-        return $query->where(function ($model) {
43
+        return $query->where(function($model) {
44 44
             return $model->whereNotNull('end_at')
45 45
                 ->where('end_at', '<=', (string) Carbon::now());
46 46
         });
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function scopeIsUpcoming(Builder $query)
56 56
     {
57
-        return $query->where(function ($model) {
57
+        return $query->where(function($model) {
58 58
             return $model->whereNotNull('start_at')
59 59
                 ->where('start_at', '>', (string) Carbon::now());
60 60
         });
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function scopeIsNotActive(Builder $query)
70 70
     {
71
-        return $query->where(function ($model) {
72
-            return $model->isExpired()->orWhere(function ($q) {
71
+        return $query->where(function($model) {
72
+            return $model->isExpired()->orWhere(function($q) {
73 73
                 $q->isUpcoming();
74 74
             });
75 75
         });
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function scopeIsNotExpired(Builder $query)
85 85
     {
86
-        return $query->where(function ($model) {
86
+        return $query->where(function($model) {
87 87
             return $model->whereNull('end_at')
88 88
                 ->orWhere('end_at', '>', (string) Carbon::now());
89 89
         });
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function scopeIsNotUpcoming(Builder $query)
99 99
     {
100
-        return $query->where(function ($model) {
100
+        return $query->where(function($model) {
101 101
             return $model->whereNull('start_at')
102 102
                 ->orWhere('start_at', '<=', (string) Carbon::now());
103 103
         });
Please login to merge, or discard this patch.
models/Category.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     /**
36 36
      * @var array Guarded fields
37 37
      */
38
-    protected $guarded = ['*'];
38
+    protected $guarded = [ '*' ];
39 39
 
40 40
     /**
41 41
      * @var array Fillable fields
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         'products' => [
66 66
             'Bedard\Shop\Models\Product',
67 67
             'table' => 'bedard_shop_category_product',
68
-            'pivot' => ['is_inherited'],
68
+            'pivot' => [ 'is_inherited' ],
69 69
         ],
70 70
     ];
71 71
 
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $categories = self::select('id', 'parent_id')->get();
119 119
 
120
-        $tree = [];
120
+        $tree = [ ];
121 121
         foreach ($categories as $category) {
122
-            $tree[$category->id] = self::walkParentCategories($categories, $category);
122
+            $tree[ $category->id ] = self::walkParentCategories($categories, $category);
123 123
         }
124 124
 
125 125
         return $tree;
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
                 ->get();
142 142
         }
143 143
 
144
-        $children = [];
144
+        $children = [ ];
145 145
         foreach ($categories as $category) {
146 146
             if ($category->parent_id == $parent) {
147
-                $children[] = $category->id;
147
+                $children[ ] = $category->id;
148 148
                 $children = array_merge($children, self::getChildIds($category->id, $categories));
149 149
             }
150 150
         }
@@ -154,23 +154,23 @@  discard block
 block discarded – undo
154 154
 
155 155
     public static function getParentIds($children, \October\Rain\Database\Collection $categories = null)
156 156
     {
157
-        if (! is_array($children)) {
158
-            $children = [$children];
157
+        if (!is_array($children)) {
158
+            $children = [ $children ];
159 159
         }
160 160
 
161 161
         if ($categories === null) {
162 162
             $categories = self::select('id', 'parent_id')->get();
163 163
         }
164 164
 
165
-        $parents = [];
165
+        $parents = [ ];
166 166
         foreach ($children as $child) {
167
-            $category = $categories->filter(function ($model) use ($child) {
167
+            $category = $categories->filter(function($model) use ($child) {
168 168
                 return $model->id == $child;
169 169
             })->first();
170 170
 
171 171
             while ($category && $category->parent_id) {
172
-                $parents[] = $category->parent_id;
173
-                $category = $categories->filter(function ($model) use ($category) {
172
+                $parents[ ] = $category->parent_id;
173
+                $category = $categories->filter(function($model) use ($category) {
174 174
                     return $model->id == $category->parent_id;
175 175
                 })->first();
176 176
             }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     public function setNullParentId()
252 252
     {
253
-        if (! $this->parent_id) {
253
+        if (!$this->parent_id) {
254 254
             $this->parent_id = null;
255 255
         }
256 256
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      */
273 273
     public function syncInheritedProductsAfterDelete()
274 274
     {
275
-        if (! $this->dontSyncAfterDelete) {
275
+        if (!$this->dontSyncAfterDelete) {
276 276
             Product::syncAllInheritedCategories();
277 277
         }
278 278
     }
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
     public static function updateMany(array $categories)
299 299
     {
300 300
         foreach ($categories as $category) {
301
-            $id = $category['id'];
302
-            unset($category['id']);
301
+            $id = $category[ 'id' ];
302
+            unset($category[ 'id' ]);
303 303
             self::whereId($id)->update($category);
304 304
         }
305 305
     }
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
      * @param  array                                $tree           Tree of parent IDs
313 313
      * @return arrau
314 314
      */
315
-    public static function walkParentCategories($categories, $category, $tree = [])
315
+    public static function walkParentCategories($categories, $category, $tree = [ ])
316 316
     {
317 317
         if ($category && $category->parent_id !== null) {
318
-            $tree[] = $category->parent_id;
318
+            $tree[ ] = $category->parent_id;
319 319
             $tree = array_merge($tree, self::walkParentCategories($categories, $categories->find($category->parent_id)));
320 320
         }
321 321
 
Please login to merge, or discard this patch.
controllers/Discounts.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@
 block discarded – undo
39 39
     public function listExtendQuery($query)
40 40
     {
41 41
         $query->with([
42
-            'categories' => function ($category) {
42
+            'categories' => function($category) {
43 43
                 return $category->select('name');
44 44
             },
45
-            'products' => function ($product) {
45
+            'products' => function($product) {
46 46
                 return $product->select('name');
47 47
             },
48 48
         ])->selectStatus();
Please login to merge, or discard this patch.
updates/1.0/create_inventory_option_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
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();
15
-            $table->primary(['inventory_id', 'option_id']);
15
+            $table->primary([ 'inventory_id', 'option_id' ]);
16 16
         });
17 17
     }
18 18
 
Please login to merge, or discard this patch.
models/Inventory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@
 block discarded – undo
16 16
     /**
17 17
      * @var array Guarded fields
18 18
      */
19
-    protected $guarded = ['*'];
19
+    protected $guarded = [ '*' ];
20 20
 
21 21
     /**
22 22
      * @var array Fillable fields
23 23
      */
24
-    protected $fillable = [];
24
+    protected $fillable = [ ];
25 25
 
26 26
     /**
27 27
      * @var array Relations
Please login to merge, or discard this patch.
updates/1.0/create_options_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function up()
10 10
     {
11
-        Schema::create('bedard_shop_options', function (Blueprint $table) {
11
+        Schema::create('bedard_shop_options', function(Blueprint $table) {
12 12
             $table->engine = 'InnoDB';
13 13
             $table->increments('id');
14 14
             $table->integer('product_id')->unsigned()->index();
Please login to merge, or discard this patch.
updates/1.0/create_inventories_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function up()
10 10
     {
11
-        Schema::create('bedard_shop_inventories', function (Blueprint $table) {
11
+        Schema::create('bedard_shop_inventories', function(Blueprint $table) {
12 12
             $table->engine = 'InnoDB';
13 13
             $table->increments('id');
14 14
             $table->integer('product_id')->unsigned()->index();
Please login to merge, or discard this patch.