-
-
Save W3SS/a113dc16cfd3a9327c0f295c75af3a2d 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