colbeh/access
| Install | |
|---|---|
composer require colbeh/access |
|
| Latest Version: | v1.2.1 |
| License: | MIT |
| Last Updated: | Sep 27, 2026 |
| Links: | GitHub · Packagist |
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
Hyro is a modular Laravel RBAC ecosystem featuring advanced role-permission mana...
Production-ready Laravel starter kit with a full admin panel, role-based access...
Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel...
User management package with ACL for managing Users / Roles / Permissions in Lar...
Complete user, role and permission management for Filament 5 with Spatie Laravel...