protected function getAssociatedAbilityIds(Model $authority, array $abilityIds, $forbidden) { return $authority->abilities()->whereIn('id', $abilityIds)->wherePivot('forbidden', '=', $forbidden)->get(['id'])->pluck('id')->all(); }