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.

Revisions

  1. dannetstudio created this gist Oct 6, 2022.
    10 changes: 10 additions & 0 deletions getCreatedAtAttribute.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    <?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());
    }