Created
June 16, 2015 19:57
-
-
Save rodurma/253afbf0ea90b04fec67 to your computer and use it in GitHub Desktop.
Trabalhando com timezones no Laravel usando mutators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function getCreatedAtAttribute($value) | |
| { | |
| $timezone = Auth::check() ? Auth::user()->timezone : Config::get('app.timezone'); | |
| return Carbon::parse($value)->timezone($timezone); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment