Reference

Guide

$users->intersection()

Returns a Collection with the intersection of the given elements

$users->intersection(\Kirby\Toolkit\Collection $other): Kirby\Toolkit\Collection

Parameters

Name Type Default Description
$other Kirby\Toolkit\Collection

Return type

Kirby\Toolkit\Collection

Example

$users1 = $kirby->users()->role('admin');
$users2 = $page->authors()->toUsers();
$intersection = $users1->intersection($users2);
dump($intersection);

Inherited from

Kirby\Toolkit\Collection

Source code

kirby/src/Toolkit/Collection.php#L551