$user->hasRole($role)

Checks if the user has a particular role.

  • return (boolean)

Example

<?php if($user = $site->user() and $user->hasRole('editor')): ?>
This super secret content is only visible for editors
<?php endif ?>

Is something missing or incorrect? Edit this page on Github…