model ->with([ "orderItems", "firstItem", "lastItem", "project", "product", "customer", "manager", "bed" => function($query) { $query->with(["room","building"]); } ]) ->orderBy("id", "desc") ->paginate(10); foreach ($data as $order) { $order = $order->refreshTotal(); } return view($this->bladePath . ".index", compact("data")); } }