---
title: "Permissions — Teams for Laravel | Roundly"
description: "A permission registry for picker UIs with groups and role harvesting, plus programmatic permission and role checks."
url: https://roundly-consulting.com/open-source/docs/teams-for-laravel/permissions
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Teams for Laravel](https://roundly-consulting.com/open-source/docs/teams-for-laravel.md)

# Permissions

Permissions are plain string keys on roles. The permission registry, Teams::permissions(), lists every known permission — for a role editor or a permission picker — independently of which roles use them. Permissions are code constants, so the registry lives in memory (there is no database driver):

```php
use RoundlyConsulting\Teams\Facades\Teams;

Teams::permissions()->register('posts.publish', 'Publish posts', group: 'Content');
Teams::permissions()->register('billing.manage', 'Manage billing', group: 'Billing');
Teams::permissions()->group('Content', ['posts.edit', 'posts.delete']);

Teams::permissions()->all();                   // array<string, Permission> — registered only
Teams::permissions()->find('posts.publish');   // ?Permission
Teams::permissions()->fromRoles();             // registered + every distinct permission declared on roles
```

group() tags permissions with a UI group and keeps the names of those already registered. fromRoles() adds every distinct permission declared on your registered roles, so a host that only declared permissions on roles still gets a full catalogue:

```php
// Section a permission picker by group:
$grouped = collect(Teams::permissions()->fromRoles())->groupBy('group');

$permission = Teams::permissions()->find('posts.publish');
$permission->key;     // 'posts.publish'
$permission->name;    // 'Publish posts'
$permission->group;   // 'Content'
```

## Checking permissions

```php
$team->memberHasPermission($user, 'posts.publish');   // bool
$user->hasTeamPermission($team, 'posts.publish');     // bool — HasTeams
$team->memberHasRole($user, 'admin');                 // bool

$role = $team->findMember($user)?->role();
$role?->hasAnyPermission(['posts.edit', 'posts.publish']);
```

memberHasPermission() resolves the member’s role (per-team aware) and returns false for non-members, expired memberships and unregistered roles. In controllers and views, prefer the Gate — see Authorization.

## Listing permissions

```bash
php artisan teams:permissions   # Key | Name | Group
```

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/teams-for-laravel.md)
