我有一个像这样的分页:
//Controller (UserController)
public show(){
$users = DB::table('user')->paginate(15);
return view('user');
}
public process(Request $request){
//something update
return $this->show();
}
//View (user.blade.php)
<head>
<script>
//submit user's id and name to UserController@process
</script>
</head>
<body>
{{ $users->link() }}
<table>
<thead>
<tr>
<th>userName</th>
<th>modifly</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<td><input type="text" value="{{ $user->name }}"</td>
<td><input type="submit" value="modifly"></td>
</tr>
@endforeach
</tbody>
</table>
</body>
当我在第 3 页提交请求时,它会像我最初查看('user')一样显示第 1 页,但我需要在提交后显示 currentPage 页面。
当我在第 3 页提交请求时,如何将第 3 页($users->currentPage()) 传递给 DB::table('user')->paginate(15) 和 view('user') 与 currentPage?