Your question is ambiguous; where is the state name stored?
May 18, 2021
6
Level 1
Count Function in Laravel PHP syntax help
I have a table users and it has list of states of a country now I want to print a table with State Name and number of times it repeats in the column to count the number of persons from that state. here is the basic code I am trying to create
<thead>
<tr class="fw-bolder fs-6 text-gray-800 px-7">
<th>Name of State</th>
<th>Number of Applicants from this state</th>
</tr>
</thead>
<tbody>
@foreach ($users as $user)
<tr>
<td>{{$user->state}}</td> //this prints the state name list as per the database entry records
<td></td>
</tr>
@endforeach
</tbody>
Please or to participate in this conversation.