I am trying to apply pagination on my laravel project. But when I put pagination code, it makes numeric pagination and when I click button for next page to show other data. Its does not work. My URL right now is : http://localhost/buildcrm/public/staff and here is my URL when I click for the second page : http://localhost/staff?page=2 .
Here is my pagination code:
<?php
$users = DB::table('staff')->paginate(4);
$i = 0;
foreach($users as $row) {
$city =$row->city.','.$row->pincode;
$name = explode(',',$row->name);
$i = $i + 1;
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $name[0]; ?> <?php echo $name[1]; ?> <?php echo $name[2]; ?></td>
<td>
<a href="<?php echo 'editstaff/'.$row->staff_id; ?>" class="btn btn-xs btn-info" >Edit</a> <a href="<?php echo 'Deletestaff/'.$row->staff_id; ?>" class="btn btn-xs btn-danger">Delete</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<div align="center">
<?php echo $users->render(); ?>
</div>
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1oXXR9i
via IFTTT
Aucun commentaire:
Enregistrer un commentaire