@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | public function scopeSelectSubquery($query, $subquery, $as) |
| 15 | 15 | { |
| 16 | 16 | if (empty($query->getQuery()->columns)) { |
| 17 | - $query->select($this->getTable() . '.*'); |
|
| 17 | + $query->select($this->getTable().'.*'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | return $subquery instanceof Builder |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function scopeJoinSubquery($query, $subquery, $alias, $left, $operator, $right, $join = 'join') |
| 40 | 40 | { |
| 41 | - $self = $this->getTable() . '.*'; |
|
| 41 | + $self = $this->getTable().'.*'; |
|
| 42 | 42 | if (!in_array($self, $query->getQuery()->columns)) { |
| 43 | 43 | $query->addSelect($self); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $subquery = $subquery->getQuery(); |
| 47 | - $raw = DB::raw('(' . $subquery->toSql() . ') ' . $alias); |
|
| 47 | + $raw = DB::raw('('.$subquery->toSql().') '.$alias); |
|
| 48 | 48 | |
| 49 | 49 | return $query->$join($raw, $left, $operator, $right)->mergeBindings($subquery); |
| 50 | 50 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * @var array Guarded fields |
| 47 | 47 | */ |
| 48 | - protected $guarded = ['*']; |
|
| 48 | + protected $guarded = [ '*' ]; |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @var array Fillable fields |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | /** |
| 72 | 72 | * @var array Relations |
| 73 | 73 | */ |
| 74 | - public $hasMany = []; |
|
| 75 | - public $morphMany = []; |
|
| 74 | + public $hasMany = [ ]; |
|
| 75 | + public $morphMany = [ ]; |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * @var array Validation rules |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | public function filterFields($fields) |
| 115 | 115 | { |
| 116 | 116 | $fields->amount_exact->hidden = $this->is_percentage; |
| 117 | - $fields->amount_percentage->hidden = ! $this->is_percentage; |
|
| 117 | + $fields->amount_percentage->hidden = !$this->is_percentage; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | public function scopeSelectStatus($query) |
| 131 | 131 | { |
| 132 | 132 | $grammar = $query->getQuery()->getGrammar(); |
| 133 | - $start_at = $grammar->wrap($this->table . '.start_at'); |
|
| 134 | - $end_at = $grammar->wrap($this->table . '.end_at'); |
|
| 133 | + $start_at = $grammar->wrap($this->table.'.start_at'); |
|
| 134 | + $end_at = $grammar->wrap($this->table.'.end_at'); |
|
| 135 | 135 | $now = Carbon::now(); |
| 136 | 136 | |
| 137 | - $subquery = "CASE " . |
|
| 138 | - "WHEN ({$end_at} IS NOT NULL AND {$end_at} < '{$now}') THEN 0 " . |
|
| 139 | - "WHEN ({$start_at} IS NOT NULL AND {$start_at} > '{$now}') THEN 2 " . |
|
| 140 | - "ELSE 1 " . |
|
| 137 | + $subquery = "CASE ". |
|
| 138 | + "WHEN ({$end_at} IS NOT NULL AND {$end_at} < '{$now}') THEN 0 ". |
|
| 139 | + "WHEN ({$start_at} IS NOT NULL AND {$start_at} > '{$now}') THEN 2 ". |
|
| 140 | + "ELSE 1 ". |
|
| 141 | 141 | "END"; |
| 142 | 142 | |
| 143 | 143 | return $query->selectSubquery($subquery, 'status'); |