//返回有顺序的客户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