You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,11 @@ protected $routeMiddleware = [
31
31
- HasRolesIds is for roles based on ids (methods suffix is ById or ByIds). HasRolesIds is actually for combining with HasRole.
32
32
- 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.
33
33
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
+
34
39
## Middleware
35
40
If you want to determine which user can use the link. You need to use one of three middleware: roles, roles, allofroles.
36
41
@@ -86,10 +91,7 @@ Examples: (Attention you have to define admin, moderator and writer roles before
86
91
$user->removeRoles(['admin', 'mod']);
87
92
```
88
93
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
93
95
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.
0 commit comments