Beartropy Permissions
1. Install via Composer
Install the package via Composer. This will also install spatie/laravel-permission as a dependency.
1composer require beartropy/permissions
2. Publish Spatie Migrations and Run
Publish the Spatie permission migrations and run them:
1php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"2php artisan migrate
3. Add HasRoles Trait to Your User Model
Make sure your User model uses the HasRoles trait from Spatie:
1use Spatie\Permission\Traits\HasRoles;2 3class User extends Authenticatable4{5 use HasRoles;6}
4. Publish Configuration (Optional)
To customize the package behavior, publish the configuration file. This will create a configuration file at config/beartropy-permissions.php.
1php artisan vendor:publish --tag=beartropy-permissions-config
5. Access the UI
You can later customize the url, middleware, etc. in the config file.
Full Permissions Manager
Embed the complete permissions manager with tabs for roles, permissions, and users:
1<livewire:beartropy-permissions::permissions-manager />
Individual Tables
You can also embed individual tables separately in your views:
1{{-- Roles table only --}}2<livewire:beartropy-permissions::roles-table />3 4{{-- Permissions table only --}}5<livewire:beartropy-permissions::permissions-table />6 7{{-- Users table only --}}8<livewire:beartropy-permissions::users-table />