Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tony98ms/livewire-permission-manager
Package that provides a graphical interface to manage roles and permissions.
https://github.com/tony98ms/livewire-permission-manager
laravel laravel-permissions livewire permissions php roles
Last synced: 3 days ago
JSON representation
Package that provides a graphical interface to manage roles and permissions.
- Host: GitHub
- URL: https://github.com/tony98ms/livewire-permission-manager
- Owner: tony98ms
- License: mit
- Created: 2021-10-09T04:37:13.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-12-27T15:40:19.000Z (7 days ago)
- Last Synced: 2024-12-27T16:31:24.670Z (7 days ago)
- Topics: laravel, laravel-permissions, livewire, permissions, php, roles
- Language: Blade
- Homepage:
- Size: 99.6 KB
- Stars: 19
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOD.md
- License: LICENSE
Awesome Lists containing this project
README
# livewire-permission-manager
[![Latest Stable Version](https://img.shields.io/packagist/v/tonystore/livewire-permission-manager?label=version)](https://packagist.org/packages/tonystore/livewire-permission-manager)
[![Packagist Downloads](https://img.shields.io/packagist/dt/tonystore/livewire-permission-manager)](https://packagist.org/packages/tonystore/livewire-permission-manager)
[![License](https://img.shields.io/packagist/l/tonystore/livewire-permission-manager)](https://packagist.org/packages/tonystore/livewire-permission-manager)
[![PHP Version Require](https://img.shields.io/packagist/dependency-v/tonystore/livewire-permission-manager/php)](https://packagist.org/packages/tonystore/livewire-permission-manager)
Package that provides a graphical interface to manage roles and permissions.
## REQUIREMENTS- [PHP >= ^8.0](http://php.net)
- [Laravel 7|8|9|10](https://laravel.com)
- [Livewire 2|3](https://livewire.laravel.com/)
- [Laravel Permission](https://github.com/spatie/laravel-permission)
- [Bootstrap 4.5 | 4.6 | ^5.0](https://getbootstrap.com) or [Tailwind](https://tailwindcss.com)## Version Compatibility Livewire
Livewire | Livewire Permission Manager
:---------|:----------
2.x | 0.2.x
3.x | 0.3.x## INSTALLATION VIA COMPOSER
### Step 1: Composer
Run this command line in console.
``` bash
composer require tonystore/livewire-permission-manager
```
### Step 2: Publish Assets
#### Publish Config File
``` bash
php artisan vendor:publish --provider="Tonystore\LivewirePermission\LivewirePermissionProvider" --tag=config-permission
```
#### Publish Views
Publish the views only if any modifications to the interfaces are required.
``` bash
php artisan vendor:publish --provider="Tonystore\LivewirePermission\LivewirePermissionProvider" --tag=views-permission
```#### Publish Migrations
Publishes migrations, only if a new column is created for the detail of a role or permission.
``` bash
php artisan vendor:publish --provider="Tonystore\LivewirePermission\LivewirePermissionProvider" --tag=migrations-permission
```#### Publish Lang
Publish the translations in case you wish to modify any of them.
``` bash
php artisan vendor:publish --provider="Tonystore\LivewirePermission\LivewirePermissionProvider" --tag=langs-permission
```
## Usage
By default, Tailwind is used to create the role and permissions management interface, but you can also choose the Bootstrap theme.```php
'tailwind',
];
```### Configure templates
You have 2 alternatives to use with this package, using the blade directives or using the laravel components.
```php
[
'type' => 'components', //Supported Type: 'components, directives'
'component' => 'AppLayout', //type: components
'directives' => [ //type: directives
'extends' => 'layouts.app',
'section-content' => 'content',
],
],
];
```
**Includes the component that contains the scripts and styles needed for the graphic interface.**
```html....
....
...
@livewireScripts
//INSERT COMPONENT
```
**To remove a role, SweetAlert is used, so you must have it in your design, and it must be before the script component.**
**Note that you must import it after the Livewire scripts.**### Select a Modal design
You will be able to select among the types of manners that the package will have, at the moment only a list type model is available, which is configured here:```php
[
'role' => 'list'
],
];
```### Customized page
Here you define the array of numbers for the paging options.```php
[
'perPages' => [
10, 25, 50, 100, 200
]
]
```### Change tables name
Here you assign the names of the tables to be able to run the migration. By default it uses the tables listed in the Laravel Permission package.```php
[
'roles' => config('permission.table_names.roles', 'roles'),
'permissions' => config('permission.table_names.permissions', 'permissions'),
],
];
```### Exclude roles
Here you define the roles you want to exclude from Livewire queries for display and modification. By default you will have an empty array.
```php
[
'excludes' => []
]
];
```
### Column name
Here you define the name of the new column that will be created in the roles and permissions table defined, with this you can add a description to each role or permission created, by default the name of the column is description. By default the name.
```php
[
'add_column' => false,
'description' => null,
],
];
```
**If you mark as true the option to add the description column, you must have previously generated that column in the respective database table.**### Route
Set your own prefix and midlewares and name for the role management path and permissions. By default you will have the following:```php
[
'middleware' => [
'web',
'auth'
],
'prefix' => 'admin',
'name' => 'permission.index',
'url' => '/roles/manager'
],
];
```
Now, once everything is configured, you will be able to access the path to manage your roles.
```css
http://localhost/admin/roles/manager
```