laravel中跟据某个特定顺序去排序查出来的数据:FIND_IN_SET
//返回有顺序的客户id $customer_ids = $customer->bespeakTime($uid); $res = Customer::with('customer_industry', 'zone1', 'zone2', 'department', 'user.agent', 'tag', 'contact', 'source'); $res->whereIn('id', $customer_ids) ->where('is_call', '>=', 0) ->orderByRaw(DB::raw("FIND_IN_SET(id, '" . implode(',', $customer_ids) . "'" . ')'));//按照指定顺序排序
这里$customer_ids是一个一维数组,所以在里面要转化一下 然后在根据相应的值来排序
原文:https://blog.csdn.net/xzykai/article/details/76637781
赞赏码
![](https://files.cnblogs.com/files/lxwphp/zhifubao2.bmp)
![](https://files.cnblogs.com/files/lxwphp/weixin.bmp)
非学,无以致疑;非问,无以广识