Skip to content

Commit 3def858

Browse files
Merge branch 'main' of https://github.com/stanfortonski/Laravel-Roles into main
2 parents d3a69da + f2d5f08 commit 3def858

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ protected $routeMiddleware = [
3131
- HasRolesIds is for roles based on ids (methods suffix is ById or ByIds). HasRolesIds is actually for combining with HasRole.
3232
- HasRolesIdsAdapter is for roles based on ids but methods are exactly same samed as in HasRoles trait. It is for independent use without HasRolesIds or HasRoles. Purpose of that is middlewares and directives doesn't work with HasRoleIds methods.
3333

34+
- For HasRolesIds you have to use suffix ByIds for multiple or ById for singular. For parameter pass integer or array of integers. Example:
35+
`$user->hasRoleById(1)` instead of `$user->hasRole('nameofrole')`
36+
37+
- For HasRolesIdsAdapter you doesn't have to use suffix but for parameter you have to pass integer or array of integers. Example: `$user->hasRole(1)` instead of `$user->hasRole('nameofrole')`
38+
3439
## Middleware
3540
If you want to determine which user can use the link. You need to use one of three middleware: roles, roles, allofroles.
3641

@@ -86,10 +91,7 @@ Examples: (Attention you have to define admin, moderator and writer roles before
8691
$user->removeRoles(['admin', 'mod']);
8792
```
8893

89-
- For HasRolesIds you have to use suffix ByIds for multiple or ById for singular. For parameter pass integer or array of integers.
90-
- For HasRolesIdsAdapter you doesn't have to use suffix but for parameter you have to pass integer or array of integers.
91-
92-
## Seeding Example
94+
## Seeding
9395
If you want to define yours own roles run this command `php artisan make:seeder RoleSeeder` and next copy and paste below code to database/seeders/RoleSeeder.php.
9496
```php
9597
namespace Database\Seeders;

0 commit comments

Comments
 (0)