【发布时间】:2020-08-26 19:04:30
【问题描述】:
我有以下代码:
$ids = $adGroupsOfUser->pluck('id');
$permittedTables = extensiontables_registry::whereHas('ad_groups', function($q){
$q->whereIn("ad_group_id", $ids);
})->pluck('extensiontable_name')->toArray();
我收到此错误:
local.ERROR: ErrorException: Undefined variable: ids in E:\aether-backend\app\Http\Helpers\modelInteractions.php:51
为什么$ids 在 whereHas() 的回调中不可见?我该怎么做才能“把它放进去”?
【问题讨论】:
标签: php laravel eloquent orm lumen