<tr> <td>No</td> <td>Reg ID</td> <td>College</td> <td>Name</td> <td>Email</td> <td>Phone</td> <td>Designation</td> <td>Interest</td> <td>Gender</td> <td>Food</td> </tr> </thead> <tbody> <?php $s = Faculty::with('colg')->orderBy('college', 'asc')->get(); foreach ($s as $key => $student) { $regid = $student->colg->abbr . "F" . str_pad($student->regid, 3, '0', STR_PAD_LEFT); ?> <tr> <td><?php echo $key + 1; ?> </td> <td><?php echo $regid; ?> </td> <td><?php echo $student->colg->name; ?>