Skip to content

Commit 3931e9c

Browse files
author
Angy
authored
Add relationships permissions in README
I've been struggling with belongsTo relationships not being available for my roles. I tried debugging the package and noticed that a `add + Model name` permission was generated for that kind of relationships. Feel free to rephrase what I wrote if it's not clear!
1 parent dbf7ef7 commit 3931e9c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ The example above means that all actions on this resource can be performed by us
134134
];
135135
```
136136

137+
### Relationships
138+
To allow your users to specify a relationship on your model, you will need to add another permission on the Model.
139+
For example, if your `Product` belongs to `User`, add the following permission on `app/Nova/User.php`. :
140+
141+
```php
142+
public static $permissionsForAbilities = [
143+
'addProduct' => 'add user on products'
144+
];
145+
```
146+
137147
## Contributing
138148

139149
Contributions are welcome and will be fully credited as long as you use PSR-2, explain the issue/feature that you want to solve/add and back your code up with tests. Happy coding!

0 commit comments

Comments
 (0)