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: UPGRADING.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,18 @@ Because there are many breaking changes an upgrade is not that easy. There are m
5
5
## From v3 to v4
6
6
7
7
- Dropped support for laravel passport
8
+
- Now you have to explicitly define the `allowRestify` method in the model policy, by default Restify don't allow you to use repositories.
9
+
-`viewAny` policy is not used anymore, you can delete it.
8
10
- The default exception handler is the Laravel one, see `restify.php -> handler`
9
11
-`fillCallback` signature has changed
10
12
- By default it will do not allow you to attach `belongsToMany` and `morphToMany` relationships. You will have to add `BelongsToMany` or `MorphToMany` field into your repository
13
+
- All of the `Repository` getter methods should declare the returned type, for instance the `fieldsForIndex` method should say that it returns an `:array`
14
+
- Attach endpoint:
15
+
```php
16
+
"api/restify/users/{$user->id}/attach/roles", [
17
+
'roles' => [$role->id],
18
+
]
19
+
```
20
+
now requires to have a `Binaryk\LaravelRestify\Fields\BelongsToMany` or `Binaryk\LaravelRestify\Fields\MorphToMany` field to be defined in the repository.
Usually, there is necessary to store a field as `Auth::id()`. This field will be automatically populated by Restify if you specify the `append` value for it:
163
+
Usually, there is necessary to store a field as `Auth::id()`. This field will be automatically populated by Restify if you specify the `value` value for it:
Copy file name to clipboardExpand all lines: src/Repositories/Concerns/InteractsWithAttachers.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ public function authorizeBelongsToMany(RestifyRequest $request): self
20
20
{
21
21
if (is_null($field = $this->belongsToManyField($request))) {
22
22
$class = class_basename($request->repository());
23
-
abort(400, "Missing BelongsToMany or MorphToMany field for [{$request->relatedRepository}]. This field should be in the [{$class}] class.");
23
+
abort(400, "Missing BelongsToMany or MorphToMany field for [{$request->relatedRepository}]. This field should be in the [{$class}] class. Or you are not authorized to use that repository (see `allowRestify` policy method).");
0 commit comments