我试图通过产品ID,desc或asc从商品表订购中获取所有商品 .
查询:
public function getAllItems($brandid)
{
$data=DB::table('items')->where('brandid',$brandid)
->orderBy('productid' , 'desc')
->get();
return $data;
}
显示的数据没有按产品ID排序,orderBy不起作用 . 问题出在哪儿 ?
2 回答
好的,问题解决了,我有两个同名的功能,我的错误 . 谢谢
要检查查询语句以确认查询构建器的问题: