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
{{ message }}
This repository was archived by the owner on Feb 14, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,21 @@ class UserController extends Controller
43
43
}
44
44
```
45
45
46
+
### Authorisation
47
+
48
+
For authorize a resource or collection you'll need the `view` and `viewAny` on the **model policy**, which you can create passing the model to the make command:
49
+
50
+
```
51
+
php artisan make:policy UserPolicy -m User
52
+
```
53
+
54
+
Alternatively, you can pass an authorisation (boolean) to the constructor of the resource like this:
55
+
56
+
```php
57
+
// Forced to allow view the user
58
+
return new JsonApiResource($user, true);
59
+
```
60
+
46
61
## Features
47
62
48
63
- Full formatting using pure built-in model methods and properties.
0 commit comments