Skip to content

Commit

Permalink
1. Fixed default values for the roles fields
Browse files Browse the repository at this point in the history
2. Added more information into the README.md file
  • Loading branch information
brand committed Apr 24, 2024
1 parent 96b7e08 commit bdf2078
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Binary file added .docs/nova-roles-and-permissions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Laravel Nova Roles and Permissions

This package allows separating roles for admins and other types of users while stored in the same users table. Additionally, it provides functionality for managing permissions (reader/editor) for the admins of a project powered by Laravel Nova.
## Screenshots
![Sortable](./docs/nova-roles-and-permissions.png)
## Installation

### Install the package using composer
Expand All @@ -24,5 +26,10 @@ Be aware that the package will create/overwrite the next files:
- app/Policies/CorePermissions.php

```bash
php artisan vendor:publish --provider="Brand3000\NovaRolesAndPermissions\Publisher"
php artisan vendor:publish --provider="Brand3000\NovaRolesAndPermissions\Publisher" --force
```

### Run new migration
```bash
php artisan migrate
```
2 changes: 1 addition & 1 deletion app/Nova/Admin.stub
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Admin extends Resource
return $resource->id == 1;
}),

Hidden::make('role_admin', 'role_admin')->default(true),
Hidden::make('role_admin', 'role_admin')->default(1),
];
}

Expand Down
2 changes: 1 addition & 1 deletion app/Nova/User.stub
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class User extends Resource
->creationRules('required', Rules\Password::defaults())
->updateRules('nullable', Rules\Password::defaults()),

Hidden::make('role_user', 'role_user')->default(true),
Hidden::make('role_user', 'role_user')->default(1),
];
}
}

0 comments on commit bdf2078

Please sign in to comment.