wovosoft / laravel-permissions
Roles and Permissions Implementation for https://github.com/spatie/laravel-permission using Laravel and Bootstrap-Vue
Installs: 268
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 1
Forks: 2
Open Issues: 23
Language:Vue
pkg:composer/wovosoft/laravel-permissions
Requires
- php: >=7.3
- spatie/laravel-permission: ^3.11
Requires (Dev)
- dev-master
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- 1.0.0
- dev-dependabot/npm_and_yarn/resources/js/express-4.18.2
- dev-dependabot/npm_and_yarn/resources/js/qs-6.5.3
- dev-dependabot/npm_and_yarn/resources/js/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/resources/js/terser-4.8.1
- dev-dependabot/npm_and_yarn/resources/js/shell-quote-1.7.3
- dev-dependabot/npm_and_yarn/resources/js/eventsource-1.1.1
- dev-dependabot/npm_and_yarn/resources/js/async-2.6.4
- dev-dependabot/npm_and_yarn/resources/js/minimist-1.2.6
- dev-dependabot/npm_and_yarn/resources/js/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/resources/js/follow-redirects-1.14.8
- dev-dependabot/npm_and_yarn/resources/js/ajv-6.12.6
- dev-dependabot/npm_and_yarn/resources/js/node-sass-7.0.0
- dev-dependabot/npm_and_yarn/resources/js/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/resources/js/ws-6.2.2
- dev-dependabot/npm_and_yarn/resources/js/dns-packet-1.3.4
- dev-dependabot/npm_and_yarn/resources/js/browserslist-4.16.6
- dev-dependabot/npm_and_yarn/resources/js/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/resources/js/ssri-6.0.2
- dev-dependabot/npm_and_yarn/resources/js/y18n-3.2.2
- dev-dependabot/npm_and_yarn/resources/js/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/resources/js/lodash-4.17.21
- dev-dependabot/npm_and_yarn/resources/js/highlight.js-9.18.5
- dev-dependabot/npm_and_yarn/resources/js/http-proxy-1.18.1
This package is auto-updated.
Last update: 2025-10-12 14:51:54 UTC
README
Laravel Role & Permissions Front-End Implementation using spatie/laravel-permission
Package description
The package is a Front-End Implementationf of the spatie/laravel-permission package. The spatie/laravel-permission is an awesome package for managing Roles & Permissionf for Laravel applications out of the box. But currently it doesn't have the front-end to easily deploy in your application.
This package comes to solve this problem. The package implements almost every features provided by spatie/laravel-permission.
Features
- Vue Components for each possible features .
- Components are reusable. So, the default layout can be modified according to the needs of your application.
- Currently the front-end uses Bootstrap-Vue. But you can easily change it's layout.
- The front-end vue components are packaged as an npm package. You can use it as a module for you bundlers eg. Webpack,
- Check the main spatie/laravel-permission for more details.
Installation
Install via composer
composer require wovosoft/laravel-permissions
Publish Configuration File
- Publish the configuration file.
php artisan vendor:publish --provider="Wovosoft\LaravelPermissions\ServiceProvider" --tag="config"
- Publish the Vue Components. The Published components will be copied to
resources/laravel-permissions/permissionsfolder. You need to add theMain.vuecomponent to yourapp.js
php artisan vendor:publish --provider="Wovosoft\LaravelPermissions\ServiceProvider" --tag="resources"
- Publish the Migrations
php artisan vendor:publish --provider="Wovosoft\LaravelPermissions\ServiceProvider" --tag="migrations"
- Publish the Seeds
php artisan vendor:publish --provider="Wovosoft\LaravelPermissions\ServiceProvider" --tag="seeds"
Configuration
- In
App\User.phpmodel add theHasRoles.phpTrait.
//other imports goes here use Spatie\Permission\Traits\HasRoles; class User extends Authenticatable { use HasRoles; // other codes goes here }
- Now Run
php artisan migrate
- Go to
config/laravel-permissions.php. Add Default Permissions and Roles.
<?php return [ "route_name_prefix" => "Wovosoft", "route_url_prefix" => "backend", "middleware" => ["web", "auth"], "users_table" => "users", //Default Laravel Generated Name "roles_table" => config("permission.table_names.roles"), //comes from spatie config file. "permissions_table" => config("permission.table_names.permissions"), //comes from spatie config file "default_permissions" => [ [ "name" => "add user", "description" => "Can Add User" ], [ "name" => "edit user", "description" => "Can Edit User" ], [ "name" => "delete user", "description" => "Can Delete User" ] ], "default_roles" => [ [ "name" => "Super Admin", "description" => "Super Admin Manages Everything" ], [ "name" => "User", "description" => "User Role" ], [ "name" => "Customer", "description" => "Customer Role" ] ] ];
- The package adds the routes automatically prefixed by
backend, so your other routes should't be prefixed bybackend. But you can change it inconfig/laravel-permissions.phpconfig file. To check the registered routes, run in your terminal from project the root,
php artisan route:list
- The gates are automatically registered during boot-up by spatie/laravel-permission
Usage
- So, according to
config/laravel-permissions.php(#3) you can perform user abilities as follows:
if(auth()->can('permission')){ echo "Auth user is allowed to perform this operation"; }
if(App\User::find(1)->can('permission')){ echo "Auth user is allowed to perform this operation"; }
$role = Wovosoft\LaravelPermissions\Models\Roles::find(1); if($role->hasAbility('permission')){ echo "The Role with ID 1 is allowed to perform this operation"; }
- Check the main spatie/laravel-permission for more details.
Note
Please keep in mind, the default Role and Permission models provided by spatie/laravel-permission are extended in the package. That's why rather than using
Spatie\Permission\Models\Rolefor Role andSpatie\Permission\Models\Permissionplease useWovosoft\LaravelPermissions\Models\Rolesfor Role andWovosoft\LaravelPermissions\Models\Permissionsfor Permission respectively.
Example Project
Click here to check the demo project https://github.com/wovosoft/laravel-permissions-example
Security
If you discover any security related issues, please email narayanadhikary24@gmail.com or create issue in the Github Repository.
Credits
This package is bootstrapped with the help of wovosoft/crud.