-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date formatting #25
Comments
I believe it'd read // Model
protected $dates = ['ordered_at', 'created_at', 'updated_at']
public function getSomeDateAttribute()
{
return $this->ordered_at->format('m-d');
}
// View
{{ $object->ordered_at->toDateString() }}
{{ $object->some_date }} Here's what I'd expect |
@CarterBland @clemblanco True, it should be This example also lacks understanding from many perspectives.
If 3 dates are available, and to format one date, it should be named similar to the original attribute, e.g. protected $dates = ['ordered_at', 'created_at', 'updated_at']
public function getOrderedAtFormatAttribute()
{
return $this->ordered_at->format('m-d');
}
// View
{{ $object->ordered_at_format }}
{{ $object->ordered_at_format->toDateString() }} |
Is this really working?
Is it really adding a property on the fly to the Carbon object?
$object->ordered_at->some_date
doesn't really read fluent...The text was updated successfully, but these errors were encountered: