| @@ 103-112 (lines=10) @@ | ||
| 100 | * @param string $value |
|
| 101 | * @return string |
|
| 102 | */ |
|
| 103 | public function getOpenTimeAttribute($value) |
|
| 104 | { |
|
| 105 | $time = new Carbon($value, 'UTC'); |
|
| 106 | ||
| 107 | //If the user is logged in then use there preferred timezone |
|
| 108 | if (Auth::check()) |
|
| 109 | $time = $time->setTimezone(Auth::user()->timezone); |
|
| 110 | ||
| 111 | return $time->format('H:i'); |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Accessor: Get the close time of the device converted to hours and minutes |
|
| @@ 122-131 (lines=10) @@ | ||
| 119 | * @param string $value |
|
| 120 | * @return string |
|
| 121 | */ |
|
| 122 | public function getCloseTimeAttribute($value) |
|
| 123 | { |
|
| 124 | $time = new Carbon($value, 'UTC'); |
|
| 125 | ||
| 126 | //If the user is logged in then use there preferred timezone |
|
| 127 | if (Auth::check()) |
|
| 128 | $time = $time->setTimezone(Auth::user()->timezone); |
|
| 129 | ||
| 130 | return $time->format('H:i'); |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * Set the open time to UTC |
|