@@ -103,8 +103,9 @@ discard block |
||
| 103 | 103 | $time = new Carbon($value, 'UTC'); |
| 104 | 104 | |
| 105 | 105 | //If the user is logged in then use there preferred timezone |
| 106 | - if (Auth::check()) |
|
| 107 | - $time = $time->setTimezone(Auth::user()->timezone); |
|
| 106 | + if (Auth::check()) { |
|
| 107 | + $time = $time->setTimezone(Auth::user()->timezone); |
|
| 108 | + } |
|
| 108 | 109 | |
| 109 | 110 | return $time->format('H:i'); |
| 110 | 111 | } |
@@ -136,8 +137,9 @@ discard block |
||
| 136 | 137 | $time = new Carbon($value, 'UTC'); |
| 137 | 138 | |
| 138 | 139 | //If the user is logged in then use there preferred timezone |
| 139 | - if (Auth::check()) |
|
| 140 | - $time = $time->setTimezone(Auth::user()->timezone); |
|
| 140 | + if (Auth::check()) { |
|
| 141 | + $time = $time->setTimezone(Auth::user()->timezone); |
|
| 142 | + } |
|
| 141 | 143 | |
| 142 | 144 | return $time->format('H:i'); |
| 143 | 145 | } |
@@ -171,9 +173,9 @@ discard block |
||
| 171 | 173 | { |
| 172 | 174 | $time = new Carbon($value, Auth::user()->timezone); |
| 173 | 175 | $time = $time->setTimezone('UTC'); |
| 176 | + } else { |
|
| 177 | + $time = new Carbon($value, 'UTC'); |
|
| 174 | 178 | } |
| 175 | - else |
|
| 176 | - $time = new Carbon($value, 'UTC'); |
|
| 177 | 179 | |
| 178 | 180 | $this->attributes['open_time'] = $time->format('H:i:s'); |
| 179 | 181 | } |
@@ -193,9 +195,9 @@ discard block |
||
| 193 | 195 | { |
| 194 | 196 | $time = new Carbon($value, Auth::user()->timezone); |
| 195 | 197 | $time = $time->setTimezone('UTC'); |
| 198 | + } else { |
|
| 199 | + $time = new Carbon($value, 'UTC'); |
|
| 196 | 200 | } |
| 197 | - else |
|
| 198 | - $time = new Carbon($value, 'UTC'); |
|
| 199 | 201 | |
| 200 | 202 | $this->attributes['close_time'] = $time->format('H:i:s'); |
| 201 | 203 | } |
@@ -211,10 +213,11 @@ discard block |
||
| 211 | 213 | */ |
| 212 | 214 | public function getLastNetworkUpdateAtHumanAttribute() |
| 213 | 215 | { |
| 214 | - if ($this->last_network_update_at->diffInDays() > 0) |
|
| 215 | - return $this->last_network_update_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
|
| 216 | - else |
|
| 217 | - return $this->last_network_update_at->diffForHumans(); |
|
| 216 | + if ($this->last_network_update_at->diffInDays() > 0) { |
|
| 217 | + return $this->last_network_update_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
|
| 218 | + } else { |
|
| 219 | + return $this->last_network_update_at->diffForHumans(); |
|
| 220 | + } |
|
| 218 | 221 | } |
| 219 | 222 | |
| 220 | 223 | /** |
@@ -229,10 +232,11 @@ discard block |
||
| 229 | 232 | */ |
| 230 | 233 | public function getUpdatedAtHumanAttribute() |
| 231 | 234 | { |
| 232 | - if ($this->updated_at->diffInDays() > 0) |
|
| 233 | - return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
|
| 234 | - else |
|
| 235 | - return $this->updated_at->diffForHumans(); |
|
| 235 | + if ($this->updated_at->diffInDays() > 0) { |
|
| 236 | + return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
|
| 237 | + } else { |
|
| 238 | + return $this->updated_at->diffForHumans(); |
|
| 239 | + } |
|
| 236 | 240 | } |
| 237 | 241 | |
| 238 | 242 | /** |
@@ -246,10 +250,11 @@ discard block |
||
| 246 | 250 | */ |
| 247 | 251 | public function getCreatedAtHumanAttribute() |
| 248 | 252 | { |
| 249 | - if ($this->created_at->diffInDays() > 0) |
|
| 250 | - return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
|
| 251 | - else |
|
| 252 | - return $this->created_at->diffForHumans(); |
|
| 253 | + if ($this->created_at->diffInDays() > 0) { |
|
| 254 | + return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
|
| 255 | + } else { |
|
| 256 | + return $this->created_at->diffForHumans(); |
|
| 257 | + } |
|
| 253 | 258 | } |
| 254 | 259 | |
| 255 | 260 | /** |
@@ -360,10 +365,11 @@ discard block |
||
| 360 | 365 | $time_now = Carbon::now($timezone); |
| 361 | 366 | |
| 362 | 367 | //Check if the current time is during the open schedule or not |
| 363 | - if ($time_now->gt($open_time) && $time_now->lt($close_time)) |
|
| 364 | - return true; |
|
| 365 | - else |
|
| 366 | - return false; |
|
| 368 | + if ($time_now->gt($open_time) && $time_now->lt($close_time)) { |
|
| 369 | + return true; |
|
| 370 | + } else { |
|
| 371 | + return false; |
|
| 372 | + } |
|
| 367 | 373 | } |
| 368 | 374 | |
| 369 | 375 | /** |
@@ -380,20 +386,22 @@ discard block |
||
| 380 | 386 | switch ($this['cover_command']) |
| 381 | 387 | { |
| 382 | 388 | case 'open': |
| 383 | - if ($isOpen) |
|
| 384 | - $status = 'open'; |
|
| 385 | - else if ($isLocked) |
|
| 386 | - $status = 'unlocking'; |
|
| 387 | - else |
|
| 388 | - $status = 'opening'; |
|
| 389 | + if ($isOpen) { |
|
| 390 | + $status = 'open'; |
|
| 391 | + } else if ($isLocked) { |
|
| 392 | + $status = 'unlocking'; |
|
| 393 | + } else { |
|
| 394 | + $status = 'opening'; |
|
| 395 | + } |
|
| 389 | 396 | break; |
| 390 | 397 | case 'close': |
| 391 | - if ($isClosed) |
|
| 392 | - $status = 'closed'; |
|
| 393 | - else if ($isLocked) |
|
| 394 | - $status = 'unlocking'; |
|
| 395 | - else |
|
| 396 | - $status = 'closing'; |
|
| 398 | + if ($isClosed) { |
|
| 399 | + $status = 'closed'; |
|
| 400 | + } else if ($isLocked) { |
|
| 401 | + $status = 'unlocking'; |
|
| 402 | + } else { |
|
| 403 | + $status = 'closing'; |
|
| 404 | + } |
|
| 397 | 405 | break; |
| 398 | 406 | case 'lock': |
| 399 | 407 | $status = 'locked'; |
@@ -402,8 +410,9 @@ discard block |
||
| 402 | 410 | $status = 'error'; |
| 403 | 411 | } |
| 404 | 412 | |
| 405 | - if ($this->cover_status === 'error') |
|
| 406 | - $status = 'error'; |
|
| 413 | + if ($this->cover_status === 'error') { |
|
| 414 | + $status = 'error'; |
|
| 415 | + } |
|
| 407 | 416 | |
| 408 | 417 | return $status; |
| 409 | 418 | } |
@@ -27,10 +27,11 @@ |
||
| 27 | 27 | return $activity->properties; |
| 28 | 28 | }) |
| 29 | 29 | ->editColumn('created_at', function ($activity) { |
| 30 | - if ($activity->created_at->diffInDays() > 0) |
|
| 31 | - return $activity->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
|
| 32 | - else |
|
| 33 | - return $activity->created_at->diffForHumans(); |
|
| 30 | + if ($activity->created_at->diffInDays() > 0) { |
|
| 31 | + return $activity->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
|
| 32 | + } else { |
|
| 33 | + return $activity->created_at->diffForHumans(); |
|
| 34 | + } |
|
| 34 | 35 | }) |
| 35 | 36 | ->rawColumns(['causer_id', 'subject_id', 'properties']); |
| 36 | 37 | } |