Простым решением было бы объединить их отдельно. Хотя я не уверен, что это лучшее решение или нет. Вы можете попробовать, как показано ниже :
private function make_ui($result){
$data.='<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Action</th>
<th>ID</th>
<th>Date</th>
<th>Description</th>
</tr>
</thead>
<tbody>';
foreach($result as $c){
$data.='<tr class="gradeX">
<td>'. $c->id .'</td>
<td>'. $c->order_id .'</td>
<td>'. $c->name .'</td>
<td>'. $c->role .'</td>
</tr>';
}
$data.='</tbody>
<tfoot>
<tr>
<th>Action</th>
<th>ID</th>
<th>Date</th>
<th>Description</th>
</tr>
</tfoot>
</table>
</div>';
return $data;
}