colbeh/access

laravel package for role permission system
162
Install
composer require colbeh/access
Latest Version:v1.2.1
License:MIT
Last Updated:Sep 27, 2026
Links: GitHub  ·  Packagist
Maintainer: sadeghbarout

Installation:

1- Composer require colbeh/access

2- Add config file

    php artisan vendor:publish --provider="Colbeh\Access\ServiceProvider"

3- Go to config/access_colbeh and set your admin guard to check with permissions. by default uses default guard that sets in

auth.defaults.guard

4- Add this HasRoles trait to your admin Model.

     use HasRoles

5- Migrate

    php artisan migrate

6- Go to

    database/seeders/PermissionsSeeder

and add your permissions.

7- Seed your permissions

    php artisan db:seed --class=PermissionsSeeder

8- Go to App/Http/middleware/CheckPermission.php and add your conditions

9- add checkPermission to middleware kernel

Upgrade:

    composer require colbeh/access:x.x.x

Usage

Rules

You can add your rules in

     App/Http/middleware/CheckPermission.php

for every controller and method

Check with gate

If you want to check one permission in blade, you can use "permission" guard

  @can('permission','root')
        {{-- has permission --}}
  @endcan

Check with helper

If you want to check one permission in code, you can use "hasAccess" method

    if(Access::hasPermission('root')){
    
        // access granted
      
    }else{
    
        // access denied
    }
    

Roles and permissions add,edit

Here is some function to add and edit roles and permissions:

   * getAdmin ($id)
   * getRole ($id)
   
   * roleStore ($name,$desc,$permissionIds)
   * roleUpdate ($roleId,$name,$desc,$permissionIds=null)
   * roleToggle ($adminId,$permissionId)  // toggle a role to admin
   * roleAttach ($adminId,$permissionId)  // add a role to admin
   * roleDetach ($adminId,$permissionId)  // remove a role from admin
   * rolesList()
   
   * permissionToggle ($roleId,$permissionId)  // toggle a permission to role
   * permissionAttach ($roleId,$permissionId)  // add a permission to role
   * permissionDetach ($roleId,$permissionId)  // remove a permission from role
   * permissionsList ($roleId=null)

Related Packages

marufsharia/hyro

Hyro is a modular Laravel RBAC ecosystem featuring advanced role-permission mana...

16 0
smarch/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel...

2,965 52
tyondo/mnara

User management package with ACL for managing Users / Roles / Permissions in Lar...

41 2
kushelbek/filament-users-permissions-roles

Complete user, role and permission management for Filament 5 with Spatie Laravel...

4 0