Last active
October 11, 2017 17:53
-
-
Save ricardobarantini/68befd87dee76ffffc0b77590c1b9355 to your computer and use it in GitHub Desktop.
Modifica o formato da data usando Carbon no Laravel
This file contains 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
<?php | |
public function setDataAttribute($value) | |
{ | |
$this->attributes['data'] = Carbon::createFromFormat('d/m/Y', $value)->toDateString(); | |
} | |
public function getDataAttribute($value) | |
{ | |
return Carbon::parse($value)->format('d/m/Y'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment