Laravel 分页顺序 [英] Laravel paginate order by

查看:25
本文介绍了Laravel 分页顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该怎么做才能传递您在 patinate 中排序的值?

What should I do to pass the values ​​that you order by in patinate?

routes.php

$ondata = DB::table('official_news') -> orderBy('created_date', 'desc') -> get() -> paginate(7);
return View::make('main',array('ondata' => $ondata));

错误

Call to a member function paginate() on a non-object

我需要你的帮助

推荐答案

这应该可以解决问题:

$ondata = DB::table('official_news')->orderBy('created_date', 'desc')->paginate(7);

这篇关于Laravel 分页顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆