@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @var array Guarded fields |
| 36 | 36 | */ |
| 37 | - protected $guarded = ['*']; |
|
| 37 | + protected $guarded = [ '*' ]; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @var array Fillable fields |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | public function filterFields($fields) |
| 148 | 148 | { |
| 149 | 149 | $fields->amount_exact->hidden = $this->is_percentage; |
| 150 | - $fields->amount_percentage->hidden = ! $this->is_percentage; |
|
| 150 | + $fields->amount_percentage->hidden = !$this->is_percentage; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | $categoryProductIds = $this->categories() |
| 161 | 161 | ->select('id') |
| 162 | - ->with(['products' => function ($products) { |
|
| 162 | + ->with([ 'products' => function($products) { |
|
| 163 | 163 | return $products->select('id'); |
| 164 | - }]) |
|
| 164 | + } ]) |
|
| 165 | 165 | ->lists('categories.products.id'); |
| 166 | 166 | |
| 167 | 167 | $productIds = $this->products()->lists('id'); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | public function savePrices() |
| 178 | 178 | { |
| 179 | 179 | $id = $this->id; |
| 180 | - Queue::push(function ($job) use ($id) { |
|
| 180 | + Queue::push(function($job) use ($id) { |
|
| 181 | 181 | $discount = Discount::findOrFail($id); |
| 182 | 182 | $productIds = $discount->getAllProductIds(); |
| 183 | 183 | $products = Product::whereIn('id', $productIds)->select('id', 'base_price')->get(); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public static function syncAllPrices() |
| 209 | 209 | { |
| 210 | - $data = []; |
|
| 210 | + $data = [ ]; |
|
| 211 | 211 | $discounts = self::isNotExpired()->with('categories.products', 'products')->get(); |
| 212 | 212 | foreach ($discounts as $discount) { |
| 213 | 213 | $products = $discount->products; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | foreach ($products as $product) { |
| 219 | - $data[] = [ |
|
| 219 | + $data[ ] = [ |
|
| 220 | 220 | 'discount_id' => $discount->id, |
| 221 | 221 | 'end_at' => $discount->end_at, |
| 222 | 222 | 'price' => $discount->calculatePrice($product->base_price), |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | }) |
| 239 | 239 | ->get(); |
| 240 | 240 | |
| 241 | - $data = []; |
|
| 241 | + $data = [ ]; |
|
| 242 | 242 | foreach ($discounts as $discount) { |
| 243 | - $data[] = [ |
|
| 243 | + $data[ ] = [ |
|
| 244 | 244 | 'discount_id' => $discount->id, |
| 245 | 245 | 'end_at' => $discount->end_at, |
| 246 | 246 | 'price' => $discount->calculatePrice($product->base_price), |