Laravel 分页 paging

控制器文件

1
2
3
4
5
6
7
8
9
class PostController extends Controller
{
// 列表
public function index()
{
$posts = Post::orderBy('created_at', 'desc')->paginate(6);
return view('post/index', compact('posts'));
}
}

模版文件

1
{{$posts->links}}
0%