libressltd / deeppermission
full stack package allow deep permission system
0.9.1.6
2017-04-04 06:57 UTC
Requires
- dev-master
- 0.9.1.6
- 0.9.1.5
- 0.9.1.4
- 0.9.1.3
- 0.9.1.2
- 0.9.1.1
- 0.9.1
- 0.9.0.2
- 0.9.0.1
- 0.9
- 0.8.1.1
- 0.8.1
- 0.8.0.5
- 0.8.0.4
- 0.8.0.3
- 0.8.0.2
- 0.8.0.1
- 0.7.0.2
- 0.7.0.1
- 0.7
- 0.6.10.2
- 0.6.10.1
- 0.6.10
- 0.6.9.3
- 0.6.9.2
- 0.6.9.1
- 0.6.9
- 0.6.8.3
- 0.6.8.2
- 0.6.8.1
- 0.6.8
- 0.6.7.5
- 0.6.7.4
- 0.6.7.3
- 0.6.7.2
- 0.6.7.1
- 0.6.7
- 0.6.6.2
- 0.6.6.1
- 0.6.6
- 0.6.5.1
- 0.6.5
- 0.6.4.1
- 0.6.4
- 0.6.3
- 0.6.2.2
- 0.6.2.1
- 0.6.2
- 0.6.1.3
- 0.6.1.2
- 0.6.1.1
- 0.6.1
- 0.6
- 0.5.2.2
- 0.5.2.1
- 0.5.2
- 0.5.1
- 0.5.0.1
- 0.5
- 0.4.2.1
- 0.4.2
- 0.4.1
- 0.4
- 0.3.1
- 0.3.0.1
- 0.3
- 0.2.5.1
- 0.2.5
- 0.2.4
- 0.2.3.1
- 0.2.3
- 0.2.2.1
- 0.2.2
- 0.2.1
- 0.2
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3.4
- 0.1.3.3
- 0.1.3.2
- 0.1.3.1
- 0.1.3
- 0.1.2
This package is not auto-updated.
Last update: 2025-01-18 20:52:16 UTC
README
Step 1: Install DeepPermission
composer require libressltd/deeppermission
Step 2: Add service provider to config/app.php
//Provider LIBRESSLtd\DeepPermission\DeepPermissionServiceProvider::class, LIBRESSLtd\LBForm\LBFormServiceProvider::class, Maatwebsite\Excel\ExcelServiceProvider::class, Collective\Html\HtmlServiceProvider::class, LIBRESSLtd\LBSA\LBSAServiceProvider::class, //Fadecade 'Excel' => Maatwebsite\Excel\Facades\Excel::class, 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class,
Step 3: Publish vendor
php artisan vendor:publish --tag=lbsa_init --force php artisan vendor:publish --tag=deeppermission --force
php artisan migrate
Step 4: Add following line to User Model (Remember to move User.php to app/Models) or you can find the newest version in vendor/libresslt/deeppermission/src/User.php
use LIBRESSLtd\DeepPermission\Traits\DPUserModelTrait; class User extends Authenticatable { use DPUserModelTrait; }
Add this row in the end of scripts.blade.php
@yield('dp_script')
Add this row to Http\Kernel.php in $routeMiddleware
'dppermission' => \App\Http\Middleware\DPPermissionMiddleware::class, 'dprole' => \App\Http\Middleware\DPRoleMiddleware::class,
Step 5 (optional): If you want a user pass all the permission, add LIBRE_DP_ADMIN_ID to your .env file
LIBRE_DP_ADMIN_ID={{user_id}}
#for example
LIBRE_DP_ADMIN_ID=1
Step 6: (for LBSA only) Move example/app.blade.php to views root folder and include libressltd.deeppermission.sidebar view
Supported function
//Check role of user $user->hasRole("role.code"); //Check permission of user (include if user has role which has permission) $user->hasPermission("permission.code"); //Query with role code User::withRole("role.code"); //Query with permission code (include user who has role which has permission) User::withPermission("permission.code"); // Using middleware middleware("dppermission:admin.read"); middleware("dprole:admin");