{"id":21499856,"url":"https://github.com/hexters/hexa-docs","last_synced_at":"2026-02-14T19:32:13.282Z","repository":{"id":245581466,"uuid":"818676247","full_name":"hexters/hexa-docs","owner":"hexters","description":"Effortless role and permission management plugin for Filament","archived":false,"fork":false,"pushed_at":"2025-11-07T23:01:01.000Z","size":115,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T14:44:13.700Z","etag":null,"topics":["access-permissions-filament","filament-access-control","filament-integration","filament-panel","filament-permission-setup","filament-resource-access","filament-widget-permissions","hexa-filament","hexa-installation","hexa-plugin","hexters-ladmin","role-and-permission-filament","role-management-filament","role-management-php"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexters.png","metadata":{"files":{"readme":"README.V2.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"hexters","ko_fi":"hexters","patreon":"hexters"}},"created_at":"2024-06-22T14:26:45.000Z","updated_at":"2025-12-26T23:52:04.000Z","dependencies_parsed_at":"2024-07-05T13:26:57.424Z","dependency_job_id":"82a88efa-cb50-4131-aa17-08589572400d","html_url":"https://github.com/hexters/hexa-docs","commit_stats":null,"previous_names":["hexters/hexa-docs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hexters/hexa-docs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexters%2Fhexa-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexters%2Fhexa-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexters%2Fhexa-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexters%2Fhexa-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexters","download_url":"https://codeload.github.com/hexters/hexa-docs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexters%2Fhexa-docs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29453425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access-permissions-filament","filament-access-control","filament-integration","filament-panel","filament-permission-setup","filament-resource-access","filament-widget-permissions","hexa-filament","hexa-installation","hexa-plugin","hexters-ladmin","role-and-permission-filament","role-management-filament","role-management-php"],"created_at":"2024-11-23T17:19:02.636Z","updated_at":"2026-02-14T19:32:13.266Z","avatar_url":"https://github.com/hexters.png","language":null,"funding_links":["https://github.com/sponsors/hexters","https://ko-fi.com/hexters","https://patreon.com/hexters"],"categories":[],"sub_categories":[],"readme":"# Filament Hexa V2\n\n**Filament Hexa** is an **easy-to-use role and permission management plugin** for Filament. Now in version 2, it supports multi-panel setups, is easier to use, and customizable.\n\n![Banner](https://github.com/hexters/assets/blob/main/hexa/v2/banner.png?raw=true)\n\n## Index\n\n* [Installation](#installation)\n* [Adding Role Select](#adding-role-select)\n* [Multi Panel](#multi-panel)\n* [Defining Permissions](#defining-permissions)\n* [Granting Access](#granting-access)\n  * [Check for User](#check-for-user)\n  * [Visible Access](#visible-access)\n  * [Laravel Access](#laravel-access)\n* [Additional Methods (optional)](#additional-methods-optional)\n  * [Adding Descriptions to Roles and Gates](#adding-descriptions-to-roles-and-gates)\n  * [Setting Role Display Order](#setting-role-display-order)\n* [Custom Access](#custom-access)\n* [Multi Tenancy](#multi-tenancy)\n* [Vendor Publish](#vendor-publish)\n* [Meta Options](#meta-options)\n* [Traits Class](#traits-class)\n* [License](#license)\n* [Bug Reports or Issues](#bug-reports-or-issues)\n\n## Installation\n\nThen install the package:\n\n```bash\ncomposer require hexters/hexa:\"^2.0\"\n```\n\nThen run the migration for roles:\n\n```bash\nphp artisan migrate\n```\n\nAfter installation, register the plugin in your panel:\n\n```php\nuse Filament\\Panel;\nuse Hexters\\Hexa\\Hexa;\n\npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        -\u003eplugins([\n            Hexa::make(),\n        ]);\n}\n```\n\nThen register the access trait in the `User` model:\n\n```php\nuse Hexters\\Hexa\\HexaRolePermission;\n\nclass User extends Authenticatable\n{\n    use HasFactory, Notifiable;\n    use HexaRolePermission; // Add this trait\n}\n```\n\n## Adding Role Select\n\nTo assign a role to a user, add a select input in your `UserResource` form:\n\n```php\nForms\\Components\\Select::make('roles')\n    -\u003elabel(__('Role Name'))\n    -\u003erelationship('roles', 'name')\n    -\u003eplaceholder(__('Superuser')),\n```\n\n## Multi Panel\n\nFilament Hexa supports multiple panels as long as each panel uses a different `Auth Guard`. The default guard is `web`.\n\n```php\npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        -\u003eauthGuard('reseller');\n}\n\npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        -\u003eauthGuard('customer');\n}\n```\n\nConfigure guards in `config/auth.php`.\n\n## Defining Permissions\n\nPermissions can be declared in Pages, Resources, Widgets, and Clusters. Example:\n\n```php\nuse Hexters\\Hexa\\HasHexaRole;\n\n. . . \n\nuse HasHexaRole;\n\npublic function defineGates(): array\n{\n    return [\n        'user.index' =\u003e __('Allows to view list of users'),\n        'user.create' =\u003e __('Allows to create new user'),\n        'user.update' =\u003e __('Allows to update user'),\n        'user.delete' =\u003e __('Allows to delete user'),\n    ];\n}\n```\n\n## Granting Access\n\nIf a user has no assigned role, they are treated as a `Superuser`, meaning they can access all defined permissions.\n\n```php\npublic static function canAccess(): bool\n{\n    return hexa()-\u003ecan('user.index');\n}\n```\n\n### Check for User\n\nWhen checking access outside an authenticated context (e.g., in queues or commands), use:\n\n```php\nreturn hexa()-\u003euser(User::first())-\u003ecan('user.index');\n```\n\n### Visible Access\n\nFilament supports `visible` on components like `Action`, `Column`, `Input`, etc.:\n\n```php\nActions\\CreateAction::make('create')\n    -\u003evisible(fn() =\u003e hexa()-\u003ecan(['user.index', 'user.create']));\n```\n\n### Laravel Access\n\nLaravel's native authorization features:\n\n```php\nAuth::user()-\u003ecan('user.create');\nGate::allows('user.create');\n\n// Only works in authenticated context (e.g., requests)\nGate::forUser(User::first())-\u003eallows('user.create');\n\n@can('user.create')\n    ...\n@endcan\n```\n\n\u003e ✅ For non-authenticated contexts:\n\u003e\n\u003e ```php\n\u003e hexa()-\u003euser(User::first())-\u003ecan('user.create');\n\u003e ```\n\n## Additional Methods (optional)\n\n### Adding Descriptions to Roles and Gates\n\n```php\nuse Hexters\\Hexa\\HasHexaRole;\n\n. . . \n\nuse HasHexaRole;\n\npublic function roleName()\n{\n    return __('User Account');\n}\n\npublic function roleDescription(): ?string\n{\n    return __('Controls access to create, read, update, delete, and more.');\n}\n\npublic function defineGateDescriptions(): array\n{\n    return [\n        'user.index' =\u003e __('Admins can access the User page'),\n        'user.create' =\u003e __('Admins can create new Users'),\n    ];\n}\n```\n\n### Setting Role Display Order\n\n```php\npublic $hexaSort = 4;\n```\n\n## Custom Access\n\nYou can define additional gates using `GateItem`:\n\n```php\nHexa::make()\n    -\u003egateItems([\n        GateItem::make(__('Horizon'))\n            -\u003edescription(__('Allows user to manage horizon page'))\n            -\u003egateItems([\n                'horizon.page' =\u003e __('Horizon Page')\n            ])\n            -\u003egateItemDescriptions([\n                'other.index' =\u003e __('Allow user to access horizon page')\n            ]),\n    ]);\n```\n\nTo customize the menu:\n\n```php\nHexa::make()\n    -\u003eshouldRegisterNavigation(true)\n    -\u003enavigationName(__('Role \u0026 Access'))\n    -\u003enavigationGroup('Settings')\n    -\u003enavigationIcon('heroicon-o-lock-open')\n    -\u003egateItems([...]);\n```\n\n## Multi Tenancy\n\nFilament Hexa supports multi-tenancy. The `HexaRole` model includes a `team_id` field and `team` relationship. You can integrate it with Filament's multi-tenancy setup.\n\n## Vendor Publish\n\nTo override the role model (e.g., for customizing tenant relationships), publish the config:\n\n```bash\nphp artisan vendor:publish --provider=\"Hexters\\Hexa\\HexaServiceProvider\"\n```\n\n## Meta Options\n\n```php\nhexa()-\u003esetOption('key-option', 'value-option');\nhexa()-\u003egetOption('key-option', 'default');\nhexa()-\u003edateOption('key-option');\nhexa()-\u003egetOptionKeys();\n```\n\n## Traits Class\n\n| Name                 | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `HexaRolePermission` | Used on the `Authenticatable` model         |\n| `HasHexaRole`        | Used on Resources, Pages, Widgets, Clusters |\n| `UuidGenerator`      | Used on models with a `uuid` field          |\n| `UlidGenerator`      | Used on models with a `ulid` field          |\n\n## License\n\nFilament Hexa requires a valid license.\nSupport the developer and purchase a license here:\n👉 [https://ppmarket.org/browse/hexters-hexa](https://ppmarket.org/browse/hexters-hexa)\n\n\n## Bug Reports or Issues\n\nPlease report issues via GitHub: [Filament Hexa Issue Tracker](https://github.com/hexters/hexa-docs/issues)\n\nThank you for using Filament Hexa. We hope it helps accelerate your development process.\n\n**Happy Coding! 🧑‍💻**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexters%2Fhexa-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexters%2Fhexa-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexters%2Fhexa-docs/lists"}