修复 N+1 的问题

This commit is contained in:
iVampireSP.com 2023-03-01 22:29:50 +08:00
parent 85d5a9186a
commit 3be7700971
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -35,7 +35,7 @@ public function show(WorkOrder $workOrder): View
{
$workOrder->load(['user', 'module', 'host']);
$replies = (new Reply)->where('work_order_id', $workOrder->id)->latest()->paginate(100);
$replies = (new Reply)->where('work_order_id', $workOrder->id)->with('user')->latest()->paginate(100);
return view('admin.work-orders.show', compact('workOrder', 'replies'));
}