Arrays 拉拉维尔反向产品列表

Arrays 拉拉维尔反向产品列表,arrays,laravel,reverse,Arrays,Laravel,Reverse,如何在Laravel中撤销产品列表? 代码如下: public function index() { $products = Product::with('owner', 'memberInfo')->paginate($this->perPage); return View::make('layouts.sales', array('products' => $products, 'status' => 'all')); } 您可以将Elounce函数

如何在Laravel中撤销产品列表? 代码如下:

public function index() {
    $products = Product::with('owner', 'memberInfo')->paginate($this->perPage);
    return View::make('layouts.sales', array('products' => $products, 'status' => 'all'));
}
您可以将Elounce函数用于集合

public function index() {
    $products = Product::with('owner', 'memberInfo');
    $products = $products->reverse()->paginate($this->perPage);
    return View::make('layouts.sales', array('products' => $products, 'status' => 'all'));
}

Oops,it响应:{“response”:false,“code”:500,“description:{“message:“Call to undefined method illumb\\Database\\Query\\Builder::reverse()”,“file:”:“\/var\/www\/html\/website\/vendor\/larvel\/framework\/src\/illumb\/Database\/Query\/Builder.php”,“line”:2113}我使用orderBy来解决上述问题。非常感谢~public function index(){$products=Product::with('owner','memberInfo');$products=$products->orderBy(“created_at”,“desc”)->paginate($this->perPage);return View::make('layouts.sales',array('products'=>$products,'status'=>all');}