Php Laravel 4按问题分页和订购
我正在尝试使用orderBy标记分页,但遇到了问题。 这是我的密码:Php Laravel 4按问题分页和订购,php,laravel,Php,Laravel,我正在尝试使用orderBy标记分页,但遇到了问题。 这是我的密码: $posts = Post::where('draft', '=', 0)->orderBy('created_at', 'id')->paginate(1)->get(); return View::make('home')->with('posts', $posts); 但它的回报是: Missing argument 1 for Illuminate\Support\Collection
$posts = Post::where('draft', '=', 0)->orderBy('created_at', 'id')->paginate(1)->get();
return View::make('home')->with('posts', $posts);
但它的回报是:
Missing argument 1 for Illuminate\Support\Collection::get()
有人能帮我纠正错误吗。谢谢不要再调用
get()
。paginate
方法本身已经执行了数据库查询:
$posts = Post::where('draft', '=', 0)->orderBy('created_at', 'id')->paginate(1);
return View::make('home')->with('posts', $posts);