@@ -15,7 +15,7 @@ |
||
| 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 |
@@ -8,7 +8,7 @@ |
||
| 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(); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * @var array Guarded fields |
| 48 | 48 | */ |
| 49 | - protected $guarded = ['*']; |
|
| 49 | + protected $guarded = [ '*' ]; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @var array Fillable fields |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function filterFields($fields) |
| 131 | 131 | { |
| 132 | 132 | $fields->amount_exact->hidden = $this->is_percentage; |
| 133 | - $fields->amount_percentage->hidden = ! $this->is_percentage; |
|
| 133 | + $fields->amount_percentage->hidden = !$this->is_percentage; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -12,7 +12,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | }); |
@@ -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 |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | foreach (Category::isParentOf($categoryIds)->lists('id') as $parentId) { |
| 113 | - $this->categories()->attach($parentId, ['is_inherited' => true]); |
|
| 113 | + $this->categories()->attach($parentId, [ 'is_inherited' => true ]); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | public function saveBasePrice() |
| 156 | 156 | { |
| 157 | 157 | Price::updateOrCreate( |
| 158 | - ['product_id' => $this->id, 'discount_id' => null], |
|
| 159 | - ['price' => $this->base_price] |
|
| 158 | + [ 'product_id' => $this->id, 'discount_id' => null ], |
|
| 159 | + [ 'price' => $this->base_price ] |
|
| 160 | 160 | ); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $subquery = Price::isActive() |
| 190 | 190 | ->addselect('bedard_shop_prices.product_id') |
| 191 | - ->selectRaw('MIN(' . $grammar->wrap('bedard_shop_prices.price') . ') as ' . $grammar->wrap('price')) |
|
| 191 | + ->selectRaw('MIN('.$grammar->wrap('bedard_shop_prices.price').') as '.$grammar->wrap('price')) |
|
| 192 | 192 | ->groupBy('bedard_shop_prices.product_id'); |
| 193 | 193 | |
| 194 | 194 | return $query |
| 195 | - ->addSelect($alias . '.price') |
|
| 196 | - ->joinSubquery($subquery, $alias, 'bedard_shop_products.id', '=', $alias . '.product_id'); |
|
| 195 | + ->addSelect($alias.'.price') |
|
| 196 | + ->joinSubquery($subquery, $alias, 'bedard_shop_products.id', '=', $alias.'.product_id'); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | public static function syncAllInheritedCategories() |
| 205 | 205 | { |
| 206 | 206 | foreach (self::lists('id') as $id) { |
| 207 | - Queue::push(function ($job) use ($id) { |
|
| 207 | + Queue::push(function($job) use ($id) { |
|
| 208 | 208 | Product::findOrFail($id)->syncInheritedCategories(); |
| 209 | 209 | $job->delete(); |
| 210 | 210 | }); |
@@ -38,14 +38,14 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function scopeJoinSubquery(Builder $query, Builder $subquery, $alias, $left, $operator, $right, $join = 'join') |
| 40 | 40 | { |
| 41 | - $self = $this->getTable() . '.*'; |
|
| 41 | + $self = $this->getTable().'.*'; |
|
| 42 | 42 | |
| 43 | 43 | if (!in_array($self, $query->getQuery()->columns)) { |
| 44 | 44 | $query->addSelect($self); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $subquery = $subquery->getQuery(); |
| 48 | - $raw = DB::raw('(' . $subquery->toSql() . ') ' . $alias); |
|
| 48 | + $raw = DB::raw('('.$subquery->toSql().') '.$alias); |
|
| 49 | 49 | |
| 50 | 50 | return $query->$join($raw, $left, $operator, $right)->mergeBindings($subquery); |
| 51 | 51 | } |