Skip to content

$users->intersection()

Returns a Collection with the intersection of the given elements

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

Parameters

Name Type Default
$other * Kirby\Toolkit\Collection

Return type

Kirby\Cms\Users

This method does not modify the existing $users object but returns a new object with the changes applied. Learn more →

Parent class

Kirby\Cms\Users inherited from Kirby\Toolkit\Collection

Example

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