Skip to content

Instantly share code, notes, and snippets.

@dannetstudio
Created October 6, 2022 18:00
Show Gist options
  • Select an option

  • Save dannetstudio/6f25eb1f08e69f2c54a3596048844ae6 to your computer and use it in GitHub Desktop.

Select an option

Save dannetstudio/6f25eb1f08e69f2c54a3596048844ae6 to your computer and use it in GitHub Desktop.
Models user timezone Accessors
<?php
public function getCreatedAtAttribute($value): Carbon
{
return Carbon::parse($value)->timezone(Helpers::getUserTimeZone());
}
public function getUpdatedAtAttribute($value): Carbon
{
return Carbon::parse($value)->timezone(Helpers::getUserTimeZone());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment