Hello, I am working on fetching data from my database and want to display it in a specific format within my view. Currently, my code is simple with a table displaying the data from the database. However, I need to format a phone number with a mask like this: (12) 94832-3823. I have tried various approaches but so far, no success. Can anyone provide me with some guidance or a hint?
Here is a snippet of my table code:
<table class="table table-bordered" id="example10" width="100%" cellspacing="0">
<thead>
<tr>
<th>{{ __('messages.serial no')}}</th>
<th>{{ __('messages.Delivery_Boy')}}</th>
<th>{{ __('messages.Delivery_Boy_Image')}}</th>
<th>{{ __('messages.Delivery_Boy_Phone')}}</th>
<th>{{ __('messages.Status')}}</th>
<th>{{ __('messages.action')}}</th>
</tr>
</tfoot>
<tbody>
@if(count($delivery_boy)>0)
@php $i=1; @endphp
@foreach($delivery_boy as $delivery_boys)
<tr>
<td>{{$i}}</td>
<td>{{$delivery_boys->delivery_boy_name}}</td>
<td align="center"><img src="{{url($delivery_boys->delivery_boy_image)}}" style="width: 21px;"></td>
<td>{{$delivery_boys->delivery_boy_phone}}</td>
<td>
@if($delivery_boys->is_confirmed==0)
<a href="{{route('confirm.delivery.status',[$delivery_boys->delivery_boy_id,'1'])}}" class="btn btn-info" style="color: #fff;">Yes</a>
<a href="{{route('confirm.delivery.status',[$delivery_boys->delivery_boy_id,'2'])}}" class="btn btn-danger" style="color: #fff;">No</a>
@elseif($delivery_boys->is_confirmed == 1)
<span style="color:green;">Aprovado</span>
@else
<span style="color:red;">Reprovado</span>
@endif
</td>
<td>
<a href="{{route('edit-delivery_boy',$delivery_boys->delivery_boy_id)}}" style="width: 28px; padding-left: 6px;" class="btn btn-info" style="width: 10px;padding-left: 9px;" style="color: #fff;"><i class="fa fa-edit" style="width: 10px;"></i></a>
<button type="button" style="width: 28px; padding-left: 6px;" class="btn btn-danger" data-toggle="modal" data-target="#exampleModal{{$delivery_boys->delivery_boy_id}}"><i class="fa fa-trash"></i></button>
</td>
</tr>
@php $i++; @endphp
@endforeach
@else
<tr>
<td>No data found</td>
</tr>
@endif
</tbody>
</table>
Current display can be seen at this link: https://i.sstatic.net/2LOpY.png
Thank you for your time!