| @@ 167-179 (lines=13) @@ | ||
| 164 | * @param string $value |
|
| 165 | * @return void |
|
| 166 | */ |
|
| 167 | public function setOpenTimeAttribute($value) |
|
| 168 | { |
|
| 169 | //If the user is logged in then use there preferred timezone |
|
| 170 | if (Auth::check()) |
|
| 171 | { |
|
| 172 | $time = new Carbon($value, Auth::user()->timezone); |
|
| 173 | $time = $time->setTimezone('UTC'); |
|
| 174 | } |
|
| 175 | else |
|
| 176 | $time = new Carbon($value, 'UTC'); |
|
| 177 | ||
| 178 | $this->attributes['open_time'] = $time->format('H:i:s'); |
|
| 179 | } |
|
| 180 | ||
| 181 | /** |
|
| 182 | * Set the close time to UTC |
|
| @@ 189-201 (lines=13) @@ | ||
| 186 | * @param string $value |
|
| 187 | * @return void |
|
| 188 | */ |
|
| 189 | public function setCloseTimeAttribute($value) |
|
| 190 | { |
|
| 191 | //If the user is logged in then use there preferred timezone |
|
| 192 | if (Auth::check()) |
|
| 193 | { |
|
| 194 | $time = new Carbon($value, Auth::user()->timezone); |
|
| 195 | $time = $time->setTimezone('UTC'); |
|
| 196 | } |
|
| 197 | else |
|
| 198 | $time = new Carbon($value, 'UTC'); |
|
| 199 | ||
| 200 | $this->attributes['close_time'] = $time->format('H:i:s'); |
|
| 201 | } |
|
| 202 | ||
| 203 | /** |
|
| 204 | * Accessor: Get the last time the server received an update call from the device in seconds/minutes/hours since |
|