| @@ 141-153 (lines=13) @@ | ||
| 138 | * @param string $value |
|
| 139 | * @return void |
|
| 140 | */ |
|
| 141 | public function setOpenTimeAttribute($value) |
|
| 142 | { |
|
| 143 | //If the user is logged in then use there preferred timezone |
|
| 144 | if (Auth::check()) |
|
| 145 | { |
|
| 146 | $time = new Carbon($value, Auth::user()->timezone); |
|
| 147 | $time = $time->setTimezone('UTC'); |
|
| 148 | } |
|
| 149 | else |
|
| 150 | $time = new Carbon($value, 'UTC'); |
|
| 151 | ||
| 152 | $this->attributes['open_time'] = $time->format('H:i:s'); |
|
| 153 | } |
|
| 154 | ||
| 155 | /** |
|
| 156 | * Set the close time to UTC |
|
| @@ 163-175 (lines=13) @@ | ||
| 160 | * @param string $value |
|
| 161 | * @return void |
|
| 162 | */ |
|
| 163 | public function setCloseTimeAttribute($value) |
|
| 164 | { |
|
| 165 | //If the user is logged in then use there preferred timezone |
|
| 166 | if (Auth::check()) |
|
| 167 | { |
|
| 168 | $time = new Carbon($value, Auth::user()->timezone); |
|
| 169 | $time = $time->setTimezone('UTC'); |
|
| 170 | } |
|
| 171 | else |
|
| 172 | $time = new Carbon($value, 'UTC'); |
|
| 173 | ||
| 174 | $this->attributes['close_time'] = $time->format('H:i:s'); |
|
| 175 | } |
|
| 176 | ||
| 177 | /** |
|
| 178 | * Accessor: Get the last time the server received and update call from the device converted to a |
|