Skip to content

Kirby 5.1.1

$users->has()

Checks if the given object or id is in the collection

$users->has(string|Kirby\Cms\User $key): bool

Parameters

Name Type Default
$keyrequired stringorKirby\Cms\User no default value

Return type

bool

This method modifies the existing $users object it is applied to and returns it again.

Parent class

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

<?php if ($kirby->users()->has('someone')): ?>
There exists a user with the username `someone`
<?php endif ?>