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