解决 N+1 的问题
This commit is contained in:
parent
89d776ddfe
commit
ec4f3bcfe5
@ -13,14 +13,12 @@ class HostController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @param Host $host
|
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function index(Host $host): View
|
public function index(): View
|
||||||
{
|
{
|
||||||
$host->load('user');
|
$hosts = Host::with('user')->paginate(100);
|
||||||
$hosts = $host->paginate(50);
|
|
||||||
|
|
||||||
return view('admin.hosts.index', compact('hosts'));
|
return view('admin.hosts.index', compact('hosts'));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user