noblemfd
1 month ago
143
3
Laravel

Current Date is being displayed when date is null

Posted 1 month ago by noblemfd

In my Laravel project:

      @foreach($employees as $key => $employee)
               <td>
                   {{$key+1}}
               </td>
               <td>
                    {{Carbon\Carbon::parse($employee->employment_date)->format('d-m-Y') ?? '' }}
               </td>                                
         </tr>
      @endforeach

I observed that the application displayed current date (today's date) whenever the date is null.

Why is it so and how do I correct that?

Please sign in or create an account to participate in this conversation.