I am trying to pagination on Laravel project.but when I put pagination code its make numberic pagination but when I click for second page for show other data its not working like my URL right now like http://localhost/buildcrm/public/staff but when I click for second page URL like http://localhost/staff?page=2 .
My pagination code like
$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>
</div>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire