Laravel package · MIT licence

SystemRoles: Laravel role management, simplified

SystemRoles is a role and permission package for Laravel: one role per user, a permission matrix your administrators manage on screen, and helpers to check it in your code.

Install with Composer
composer require baberuka/systemroles
ArticleController.php
use BabeRuka\SystemRoles\Services\SystemRolesService;

public function publish(Article $article)
{
    $roleId = SystemRolesService::roleIdForUser(auth()->id());

    abort_unless(
        SystemRolesService::roleHas($roleId, 'article.publish'),
        403
    );

    $article->publish();
}

What you get

  • Roles

    Super Admin, Admin, Manager, User, or your own. Create, edit and order them on screen.

  • Permission matrix

    Every permission, such as invoice.approve, switched on or off per role from one screen.

  • One role per user, with history

    Each user has exactly one role, and every role change is logged.

  • Controller access

    Mark which roles may use which controllers. Controllers are scanned for you.

  • Route sync

    Store every route of your app with one Artisan command and mark which roles may use it.

  • Ready-made admin area

    Manage all of it at /systemroles/admin, open only to the super admin.

Read the documentation