Skip to content

Commit

Permalink
update readme and license
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremykenedy committed Mar 23, 2019
1 parent 04b38dc commit cc88084
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Default User Model
ROLES_DEFAULT_USER_MODEL=App\User

# Roles Database Seeder Settings
ROLES_SEED_DEFAULT_PERMISSIONS=true
ROLES_SEED_DEFAULT_ROLES=true
ROLES_SEED_DEFAULT_RELATIONSHIPS=true
ROLES_SEED_DEFAULT_USERS=false
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 <Jeremy Kenedy>
Copyright (c) 2017-2019 <Jeremy Kenedy>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
188 changes: 182 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ A Powerful package for handling roles and permissions in Laravel.
- [Entity Check](#entity-check)
- [Blade Extensions](#blade-extensions)
- [Middleware](#middleware)
- [Config File](#config-file)
- [Configuration](#configuration)
- [Environment File](#environment-file)
- [More Information](#more-information)
- [File Tree](#file-tree)
- [Opening an Issue](#opening-an-issue)
- [License](#license)

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

---

## Config File
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.
## Configuration
* You can change connection for models, slug separator, models path and there is also a handy pretend feature.
* There are many configurable options which have been extended to be able to configured via `.env` file variables.
* Editing the configuration file directly may not needed becuase of this.
* See config file: [roles.php](https://github.com/jeremykenedy/laravel-roles/blob/master/config/roles.php).

```php

<?php

return [

/*
|--------------------------------------------------------------------------
| Package Connection
|--------------------------------------------------------------------------
|
| You can set a different database connection for this package. It will set
| new connection for models Role and Permission. When this option is null,
| it will connect to the main database, which is set up in database.php
|
*/

'connection' => null,

/*
|--------------------------------------------------------------------------
| Slug Separator
|--------------------------------------------------------------------------
|
| Here you can change the slug separator. This is very important in matter
| of magic method __call() and also a `Slugable` trait. The default value
| is a dot.
|
*/

'separator' => '.',

/*
|--------------------------------------------------------------------------
| Models
|--------------------------------------------------------------------------
|
| If you want, you can replace default models from this package by models
| you created. Have a look at `jeremykenedy\LaravelRoles\Models\Role` model and
| `jeremykenedy\LaravelRoles\Models\Permission` model.
|
*/

'models' => [
'role' => jeremykenedy\LaravelRoles\Models\Role::class,
'permission' => jeremykenedy\LaravelRoles\Models\Permission::class,
],

/*
|--------------------------------------------------------------------------
| Roles, Permissions and Allowed "Pretend"
|--------------------------------------------------------------------------
|
| You can pretend or simulate package behavior no matter what is in your
| database. It is really useful when you are testing you application.
| Set up what will methods hasRole(), hasPermission() and allowed() return.
|
*/

'pretend' => [

'enabled' => false,

'options' => [
'hasRole' => true,
'hasPermission' => true,
'allowed' => true,
],

],

/*
|--------------------------------------------------------------------------
| Laravel Default User Model
|--------------------------------------------------------------------------
|
| This is the applications default user model.
|
*/

'defaultUserModel' => env('ROLES_DEFAULT_USER_MODEL', config('auth.providers.users.model')),

/*
|--------------------------------------------------------------------------
| Default Seeds
|--------------------------------------------------------------------------
|
| These are the default package seeds. You can seed the package built
| in seeds without having to seed them. These seed directly from
| the package. These are not the published seeds.
|
*/

'defaultSeeds' => [
'PermissionsTableSeeder' => env('ROLES_SEED_DEFAULT_PERMISSIONS', true),
'RolesTableSeeder' => env('ROLES_SEED_DEFAULT_ROLES', true),
'ConnectRelationshipsSeeder' => env('ROLES_SEED_DEFAULT_RELATIONSHIPS', true),
'UsersTableSeeder' => env('ROLES_SEED_DEFAULT_USERS', false),
],
];


```

### Environment File
```
# Default User Model
ROLES_DEFAULT_USER_MODEL=App\User
# Roles Database Seeder Settings
ROLES_SEED_DEFAULT_PERMISSIONS=true
ROLES_SEED_DEFAULT_ROLES=true
ROLES_SEED_DEFAULT_RELATIONSHIPS=true
ROLES_SEED_DEFAULT_USERS=false
```

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

## Credit Note
This package is an adaptation of [romanbican/roles](https://github.com/romanbican/roles) and [ultraware/roles](https://github.com/ultraware/roles/).
###File Tree
```bash
├── .env.example
├── .gitignore
├── LICENSE
├── composer.json
├── config
│   └── roles.php
├── readme.md
└── src
├── Contracts
│   ├── HasRoleAndPermission.php
│   ├── PermissionHasRelations.php
│   └── RoleHasRelations.php
├── Database
│   ├── Migrations
│   │   ├── 2016_01_15_105324_create_roles_table.php
│   │   ├── 2016_01_15_114412_create_role_user_table.php
│   │   ├── 2016_01_26_115212_create_permissions_table.php
│   │   ├── 2016_01_26_115523_create_permission_role_table.php
│   │   └── 2016_02_09_132439_create_permission_user_table.php
│   └── Seeds
│   ├── DefaultConnectRelationshipsSeeder.php
│   ├── DefaultPermissionsTableSeeder.php
│   ├── DefaultRolesTableSeeder.php
│   ├── DefaultUsersTableSeeder.php
│   └── publish
│   ├── ConnectRelationshipsSeeder.php
│   ├── PermissionsTableSeeder.php
│   ├── RolesTableSeeder.php
│   └── UsersTableSeeder.php
├── Exceptions
│   ├── AccessDeniedException.php
│   ├── LevelDeniedException.php
│   ├── PermissionDeniedException.php
│   └── RoleDeniedException.php
├── Middleware
│   ├── VerifyLevel.php
│   ├── VerifyPermission.php
│   └── VerifyRole.php
├── Models
│   ├── Permission.php
│   └── Role.php
├── RolesFacade.php
├── RolesServiceProvider.php
└── Traits
├── HasRoleAndPermission.php
├── PermissionHasRelations.php
├── RoleHasRelations.php
└── Slugable.php
```

* Tree command can be installed using brew: `brew install tree`
* File tree generated using command `tree -a -I '.git|node_modules|vendor|storage|tests'`

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

## Credit Note
This package is an adaptation of [romanbican/roles](https://github.com/romanbican/roles) and [ultraware/roles](https://github.com/ultraware/roles/).

## License
This package is free software distributed under the terms of the MIT license.
This package is free software distributed under the terms of the [MIT license](https://opensource.org/licenses/MIT). Enjoy!

0 comments on commit cc88084

Please sign in to comment.