【问题标题】:Eager load on Nova Resource and ModelNova 资源和模型上的急切负载
【发布时间】:2019-03-20 04:08:36
【问题描述】:

我有 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】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-25
      • 1970-01-01
      相关资源
      最近更新 更多