We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
「何を以って重複とするか」を指定できると便利だな、という場面がありました。 例えば「ある親IDに属するメンバーからひとつのみ選択」という条件を適用する場合
$picked_parent_ids = []; Ginq::from($members) ->where(function(Members $m) use (&$picked_parent_ids) { if (!in_array($m->parent_id, $picked_parent_ids)) { $picked_parent_ids[] = $m->parent_id; return true; } else { return false; } })
のようにフィルタリングする必要がありますが、これを以下のように表現できるとスッキリします。
Ginq::from($members) ->distinctBy('parent_id');
The text was updated successfully, but these errors were encountered:
👍
Sorry, something went wrong.
No branches or pull requests
「何を以って重複とするか」を指定できると便利だな、という場面がありました。
例えば「ある親IDに属するメンバーからひとつのみ選択」という条件を適用する場合
のようにフィルタリングする必要がありますが、これを以下のように表現できるとスッキリします。
The text was updated successfully, but these errors were encountered: