【问题标题】:Laravel Nova Metrics Value, complex calculateLaravel Nova Metrics 值,复杂计算
【发布时间】:2021-08-10 06:54:08
【问题描述】:

我必须遵循模型。 经理(身份证,姓名,...) 帐户(id,manager_id,...) 订阅(id,account_id,quantity,...)

我想获取与在线经理关联的所有帐户的所有订阅。

我试过这样的。

$managerAccounts = Account::where('manager_id', auth()->id())->get('id');

return $this->count($request, Subscription::where('account_id', $managerAccounts), 'quantity');

但这不能正常工作,有什么建议吗?

【问题讨论】:

    标签: laravel metrics laravel-nova


    【解决方案1】:

    我需要做的就是把它改成 whereIn。

    $managerAccounts = Account::where('manager_id', auth()->id())->get('id');

    return $this->count($request, Subscription::whereIn('account_id', $managerAccounts), 'quantity');

    【讨论】:

      猜你喜欢
      • 2019-09-26
      • 1970-01-01
      • 1970-01-01
      • 2021-11-13
      • 1970-01-01
      • 1970-01-01
      • 2019-06-05
      • 1970-01-01
      • 2019-01-30
      相关资源
      最近更新 更多