diff --git a/app/Http/Controllers/Admin/HostController.php b/app/Http/Controllers/Admin/HostController.php index 274ac9b..673e4b7 100644 --- a/app/Http/Controllers/Admin/HostController.php +++ b/app/Http/Controllers/Admin/HostController.php @@ -20,7 +20,7 @@ class HostController extends Controller */ public function index(Request $request): View { - $hosts = Host::with('user'); + $hosts = new Host(); // 遍历所有的搜索条件 foreach (['name', 'module_id', 'status', 'user_id', 'price', 'managed_price', 'created_at', 'updated_at'] as $field) { @@ -29,6 +29,8 @@ public function index(Request $request): View } } + $hosts = $hosts->with(['user', 'module']); + $hosts = $hosts->paginate(50)->withQueryString(); return view('admin.hosts.index', compact('hosts'));