Skip to content

Commit cc88084

Browse files
committed
update readme and license
1 parent 04b38dc commit cc88084

File tree

3 files changed

+192
-8
lines changed

3 files changed

+192
-8
lines changed

.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Default User Model
2+
ROLES_DEFAULT_USER_MODEL=App\User
3+
4+
# Roles Database Seeder Settings
5+
ROLES_SEED_DEFAULT_PERMISSIONS=true
6+
ROLES_SEED_DEFAULT_ROLES=true
7+
ROLES_SEED_DEFAULT_RELATIONSHIPS=true
8+
ROLES_SEED_DEFAULT_USERS=false

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017 <Jeremy Kenedy>
3+
Copyright (c) 2017-2019 <Jeremy Kenedy>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
21+
THE SOFTWARE.

readme.md

Lines changed: 182 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ A Powerful package for handling roles and permissions in Laravel.
2929
- [Entity Check](#entity-check)
3030
- [Blade Extensions](#blade-extensions)
3131
- [Middleware](#middleware)
32-
- [Config File](#config-file)
32+
- [Configuration](#configuration)
33+
- [Environment File](#environment-file)
3334
- [More Information](#more-information)
35+
- [File Tree](#file-tree)
3436
- [Opening an Issue](#opening-an-issue)
3537
- [License](#license)
3638

@@ -534,14 +536,185 @@ You can catch these exceptions inside `app/Exceptions/Handler.php` file and do w
534536

535537
---
536538

537-
## Config File
538-
You can change connection for models, slug separator, models path and there is also a handy pretend feature. Have a look at [config file](https://github.com/jeremykenedy/laravel-roles/blob/master/config/roles.php) for more information.
539+
## Configuration
540+
* You can change connection for models, slug separator, models path and there is also a handy pretend feature.
541+
* There are many configurable options which have been extended to be able to configured via `.env` file variables.
542+
* Editing the configuration file directly may not needed becuase of this.
543+
* See config file: [roles.php](https://github.com/jeremykenedy/laravel-roles/blob/master/config/roles.php).
544+
545+
```php
546+
547+
<?php
548+
549+
return [
550+
551+
/*
552+
|--------------------------------------------------------------------------
553+
| Package Connection
554+
|--------------------------------------------------------------------------
555+
|
556+
| You can set a different database connection for this package. It will set
557+
| new connection for models Role and Permission. When this option is null,
558+
| it will connect to the main database, which is set up in database.php
559+
|
560+
*/
561+
562+
'connection' => null,
563+
564+
/*
565+
|--------------------------------------------------------------------------
566+
| Slug Separator
567+
|--------------------------------------------------------------------------
568+
|
569+
| Here you can change the slug separator. This is very important in matter
570+
| of magic method __call() and also a `Slugable` trait. The default value
571+
| is a dot.
572+
|
573+
*/
574+
575+
'separator' => '.',
576+
577+
/*
578+
|--------------------------------------------------------------------------
579+
| Models
580+
|--------------------------------------------------------------------------
581+
|
582+
| If you want, you can replace default models from this package by models
583+
| you created. Have a look at `jeremykenedy\LaravelRoles\Models\Role` model and
584+
| `jeremykenedy\LaravelRoles\Models\Permission` model.
585+
|
586+
*/
587+
588+
'models' => [
589+
'role' => jeremykenedy\LaravelRoles\Models\Role::class,
590+
'permission' => jeremykenedy\LaravelRoles\Models\Permission::class,
591+
],
592+
593+
/*
594+
|--------------------------------------------------------------------------
595+
| Roles, Permissions and Allowed "Pretend"
596+
|--------------------------------------------------------------------------
597+
|
598+
| You can pretend or simulate package behavior no matter what is in your
599+
| database. It is really useful when you are testing you application.
600+
| Set up what will methods hasRole(), hasPermission() and allowed() return.
601+
|
602+
*/
603+
604+
'pretend' => [
605+
606+
'enabled' => false,
607+
608+
'options' => [
609+
'hasRole' => true,
610+
'hasPermission' => true,
611+
'allowed' => true,
612+
],
613+
614+
],
615+
616+
/*
617+
|--------------------------------------------------------------------------
618+
| Laravel Default User Model
619+
|--------------------------------------------------------------------------
620+
|
621+
| This is the applications default user model.
622+
|
623+
*/
624+
625+
'defaultUserModel' => env('ROLES_DEFAULT_USER_MODEL', config('auth.providers.users.model')),
626+
627+
/*
628+
|--------------------------------------------------------------------------
629+
| Default Seeds
630+
|--------------------------------------------------------------------------
631+
|
632+
| These are the default package seeds. You can seed the package built
633+
| in seeds without having to seed them. These seed directly from
634+
| the package. These are not the published seeds.
635+
|
636+
*/
637+
638+
'defaultSeeds' => [
639+
'PermissionsTableSeeder' => env('ROLES_SEED_DEFAULT_PERMISSIONS', true),
640+
'RolesTableSeeder' => env('ROLES_SEED_DEFAULT_ROLES', true),
641+
'ConnectRelationshipsSeeder' => env('ROLES_SEED_DEFAULT_RELATIONSHIPS', true),
642+
'UsersTableSeeder' => env('ROLES_SEED_DEFAULT_USERS', false),
643+
],
644+
];
645+
646+
647+
```
648+
649+
### Environment File
650+
```
651+
# Default User Model
652+
ROLES_DEFAULT_USER_MODEL=App\User
653+
654+
# Roles Database Seeder Settings
655+
ROLES_SEED_DEFAULT_PERMISSIONS=true
656+
ROLES_SEED_DEFAULT_ROLES=true
657+
ROLES_SEED_DEFAULT_RELATIONSHIPS=true
658+
ROLES_SEED_DEFAULT_USERS=false
659+
```
539660

540661
## More Information
541662
For more information, please have a look at [HasRoleAndPermission](https://github.com/jeremykenedy/laravel-roles/blob/master/src/Contracts/HasRoleAndPermission.php) contract.
542663

543-
## Credit Note
544-
This package is an adaptation of [romanbican/roles](https://github.com/romanbican/roles) and [ultraware/roles](https://github.com/ultraware/roles/).
664+
###File Tree
665+
```bash
666+
├── .env.example
667+
├── .gitignore
668+
├── LICENSE
669+
├── composer.json
670+
├── config
671+
│   └── roles.php
672+
├── readme.md
673+
└── src
674+
├── Contracts
675+
│   ├── HasRoleAndPermission.php
676+
│   ├── PermissionHasRelations.php
677+
│   └── RoleHasRelations.php
678+
├── Database
679+
│   ├── Migrations
680+
│   │   ├── 2016_01_15_105324_create_roles_table.php
681+
│   │   ├── 2016_01_15_114412_create_role_user_table.php
682+
│   │   ├── 2016_01_26_115212_create_permissions_table.php
683+
│   │   ├── 2016_01_26_115523_create_permission_role_table.php
684+
│   │   └── 2016_02_09_132439_create_permission_user_table.php
685+
│   └── Seeds
686+
│   ├── DefaultConnectRelationshipsSeeder.php
687+
│   ├── DefaultPermissionsTableSeeder.php
688+
│   ├── DefaultRolesTableSeeder.php
689+
│   ├── DefaultUsersTableSeeder.php
690+
│   └── publish
691+
│   ├── ConnectRelationshipsSeeder.php
692+
│   ├── PermissionsTableSeeder.php
693+
│   ├── RolesTableSeeder.php
694+
│   └── UsersTableSeeder.php
695+
├── Exceptions
696+
│   ├── AccessDeniedException.php
697+
│   ├── LevelDeniedException.php
698+
│   ├── PermissionDeniedException.php
699+
│   └── RoleDeniedException.php
700+
├── Middleware
701+
│   ├── VerifyLevel.php
702+
│   ├── VerifyPermission.php
703+
│   └── VerifyRole.php
704+
├── Models
705+
│   ├── Permission.php
706+
│   └── Role.php
707+
├── RolesFacade.php
708+
├── RolesServiceProvider.php
709+
└── Traits
710+
├── HasRoleAndPermission.php
711+
├── PermissionHasRelations.php
712+
├── RoleHasRelations.php
713+
└── Slugable.php
714+
```
715+
716+
* Tree command can be installed using brew: `brew install tree`
717+
* File tree generated using command `tree -a -I '.git|node_modules|vendor|storage|tests'`
545718

546719
## Opening an Issue
547720
Before opening an issue there are a couple of considerations:
@@ -557,5 +730,8 @@ Before opening an issue there are a couple of considerations:
557730
* Need some help, I can do my best on Slack: https://opensourcehelpgroup.slack.com
558731
* Please be considerate that this is an open source project that I provide to the community for FREE when opening an issue.
559732

733+
## Credit Note
734+
This package is an adaptation of [romanbican/roles](https://github.com/romanbican/roles) and [ultraware/roles](https://github.com/ultraware/roles/).
735+
560736
## License
561-
This package is free software distributed under the terms of the MIT license.
737+
This package is free software distributed under the terms of the [MIT license](https://opensource.org/licenses/MIT). Enjoy!

0 commit comments

Comments
 (0)