Level 33
try with this
<h6 class="lead"><b>Hire Date: </b>{{ $employee->hire_date ? \Carbon\Carbon::parse($employee->hire_date)->format('d-m-Y') : "" }} </h6>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In my index.blade, I have this:
<h6 class="lead"><b>Hire Date: </b>{{ \Carbon\Carbon::parse($employee->hire_date)->format('d-m-Y') }} </h6>
But I observed that when hire_date is not available, it displays the current date.
How do I display None or Null when the hire_date is not available instead of the current date?
Thanks
try with this
<h6 class="lead"><b>Hire Date: </b>{{ $employee->hire_date ? \Carbon\Carbon::parse($employee->hire_date)->format('d-m-Y') : "" }} </h6>
Please or to participate in this conversation.