Level 102
Add you own fallback
{{ $user->profile->doh ? \Carbon\Carbon::parse($user->profile->doh)->format('m/d/Y H:i') : 'no date' }}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a form field that is receives the following as its value:
{{ \Carbon\Carbon::parse($user->profile->doh)->format('m/d/Y H:i') }}
The value is sometime NULL. When it is NULL, it outputs the current date and time.
What is the best way to handle these type of dates in Laravel 8?
Please or to participate in this conversation.