过度消耗Nova资源和模型

时间:2019-03-20 04:08:37

标签: laravel laravel-nova

我有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'];

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

1 个答案:

答案 0 :(得分:0)

您可以使用barryvdh / laravel-debugbar,您将找到所需的所有答案。

相关问题