改进 排序

This commit is contained in:
iVampireSP.com 2023-02-02 20:35:44 +08:00
parent 0ae44a85cb
commit b28ae8af8f
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -22,6 +22,11 @@ public function index(WorkOrder $workOrder): View
{
$workOrders = $workOrder->with(['user', 'host', 'module'])->latest()->paginate(20)->withQueryString();
// 根据 status 排序, closed 的在后面
$workOrders = $workOrders->sortBy(function ($workOrder) {
return $workOrder->status === 'closed';
});
return view('admin.work-orders.index', compact('workOrders'));
}