cboxdk / lighthouse-spatie-permissions
Adds types and mutations to lighthouse-php GraphQL for spatie/laravel-permission
Requires
- php: ^8.1
- illuminate/contracts: ^9.0
- nuwave/lighthouse: ^5.55
- spatie/laravel-package-tools: ^1.9.2
- spatie/laravel-permission: ^5.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-11-09 12:54:11 UTC
README
This package is created for internal use with heavy inspiration from mlab817/lighthouse-graphql-permission.
Installation
You can install the package via composer:
composer require cboxdk/lighthouse-spatie-permissions
You can publish the config file with:
php artisan vendor:publish --tag="lighthouse-spatie-permissions-config"
This is the contents of the published config file:
return [ /* * Define where the schema will be stored */ 'schema' => null, /* * Determine the guard to use as default guard_name when creating roles and permissions * Defaults to api */ 'guard' => env('LIGHTHOUSE_PERMISSION_GUARD', 'api'), /* * Restrict mutations to specific role */ 'restrict' => [ 'role' => env('LIGHTHOUSE_PERMISSION_RESTRICT_MUTATIONS','admin') ], 'users' => [ 'table' => env('LIGHTHOUSE_PERMISSION_USERS_TABLE', 'users'), ], ];
Optionally, you can publish the views using
php artisan vendor:publish --tag="lighthouse-spatie-permissions-views"
Usage
The graphql schema is added to lighthouse. You may change it or use as is.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Sylvester Nielsen
- mlab817/lighthouse-graphql-permission
License
The MIT License (MIT). Please see License File for more information.