我有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'];
如果我在资源和模型上都这样做。它会导致重复的查询吗?
你可以使用barryvdh / laravel-debugbar,你会找到你需要的所有答案。