对Nova资源和模型的热切加载

问题描述 投票:0回答:1

我有2个表:产品和类别。我是否应该在Nova Resource中声明如下所示:


// For Product Resource

/**
 * The relationships that should be eager loaded on index queries.
 *
 * @var array
 */
public static $with = ['categories'];

或者在这样的模型上:

// For model App\Product

protected $with = ['categories'];

如果我在资源和模型上都这样做。它会导致重复的查询吗?

laravel laravel-nova
1个回答
0
投票

你可以使用barryvdh / laravel-debugbar,你会找到你需要的所有答案。

© www.soinside.com 2019 - 2024. All rights reserved.