Completed
Push — master ( 9dc00c...932e6e )
by Scott
02:45
created
models/Discount.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @var array Guarded fields
35 35
      */
36
-    protected $guarded = ['*'];
36
+    protected $guarded = [ '*' ];
37 37
 
38 38
     /**
39 39
      * @var array Fillable fields
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     public function filterFields($fields)
147 147
     {
148 148
         $fields->amount_exact->hidden = $this->is_percentage;
149
-        $fields->amount_percentage->hidden = ! $this->is_percentage;
149
+        $fields->amount_percentage->hidden = !$this->is_percentage;
150 150
     }
151 151
 
152 152
     /**
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
     {
159 159
         $categoryProductIds = $this->categories()
160 160
             ->select('id')
161
-            ->with(['products' => function ($products) {
161
+            ->with([ 'products' => function($products) {
162 162
                 return $products->select('id');
163
-            }])
163
+            } ])
164 164
             ->lists('categories.products.id');
165 165
 
166 166
         $productIds = $this->products()->lists('id');
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     public function savePrices()
177 177
     {
178 178
         $id = $this->id;
179
-        Queue::push(function ($job) use ($id) {
179
+        Queue::push(function($job) use ($id) {
180 180
             $discount = Discount::findOrFail($id);
181 181
             $productIds = $discount->getAllProductIds();
182 182
             $products = Product::whereIn('id', $productIds)->select('id', 'base_price')->get();
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public static function syncAllPrices()
208 208
     {
209
-        $data = [];
209
+        $data = [ ];
210 210
         $discounts = self::isNotExpired()->with('categories.products', 'products')->get();
211 211
         foreach ($discounts as $discount) {
212 212
             $products = $discount->products;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             }
216 216
 
217 217
             foreach ($products as $product) {
218
-                $data[] = [
218
+                $data[ ] = [
219 219
                     'discount_id' => $discount->id,
220 220
                     'end_at' => $discount->end_at,
221 221
                     'price' => $discount->calculatePrice($product->base_price),
@@ -235,14 +235,14 @@  discard block
 block discarded – undo
235 235
             ->whereHas('products', function($product) use ($product) {
236 236
                 return $product->where('id', $product->id);
237 237
             })
238
-            ->orWhereHas('categories', function ($category) use ($categoryIds) {
238
+            ->orWhereHas('categories', function($category) use ($categoryIds) {
239 239
                 return $category->whereIn('id', $categoryIds);
240 240
             })
241 241
             ->get();
242 242
 
243
-        $data = [];
243
+        $data = [ ];
244 244
         foreach ($discounts as $discount) {
245
-            $data[] = [
245
+            $data[ ] = [
246 246
                 'discount_id' => $discount->id,
247 247
                 'end_at' => $discount->end_at,
248 248
                 'price' => $discount->calculatePrice($product->base_price),
Please login to merge, or discard this patch.