Data Table For All Generated Mails

@foreach($reportData as $mail) @endforeach
S/N Date of Letter Date Received From Whom Received Institution's Ref. Subject Minute To: Folio
{{$mail->reg_no}} {{date('d M, Y', strtotime($mail->dol)) }} {{date('d M, Y', strtotime($mail->date_received))}} {{$mail->received}} {{$mail->inst_ref}} {{$mail->subject}} @php $departArray = json_decode($mail->depart, true); @endphp {{-- Check if decoding was successful --}} @if($departArray !== null) {{-- Loop through the array and display each element --}} @foreach($departArray as $element) {{ $element . ',' }} {{-- Display each element --}} @endforeach @else {{-- Handle the case where decoding fails --}} No Assign Department @endif {{$mail->folio}}