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
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Because there are many breaking changes an upgrade is not that easy. There are m
6
6
7
7
- Dropped support for laravel passport
8
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.
9
+
-`viewAny` policy isn't used anymore, you can delete it.
10
10
- The default exception handler is the Laravel one, see `restify.php -> handler`
11
11
-`fillCallback` signature has changed
12
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
Copy file name to clipboardExpand all lines: docs/docs/4.0/auth/auth.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,20 @@ You'll finally enjoy the auth setup (`register`, `login`, `forgot` and `reset pa
9
9
10
10
- Migrate the `personal_access_tokens` table, provided by sanctum.
11
11
12
+
- Install laravel sanctum. See the docs [here](https://laravel.com/docs/sanctum#installation). You don't need to add `\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,` in your `'api'` middleware group. So you only need to run these 3 commands:
- Make sure your authenticatable entity (usually `App\Models\User`) implements: `Illuminate\Contracts\Auth\Authenticatable` (or simply extends the `Illuminate\Foundation\Auth\User` class as it does into a fresh laravel app.)
13
21
14
22
- Make sure the `App\Models\User` model implements the `Binaryk\LaravelRestify\Contracts\Sanctumable` contract.
15
23
24
+
- Add `\Laravel\Sanctum\HasApiTokens` trait to your `User` model.
25
+
16
26
## Define routes
17
27
18
28
Restify provides you a simple way to add all of your auth routes ready. Simply add in your `routes/api.php`:
@@ -137,7 +147,7 @@ This method could look like this:
137
147
138
148
public function sendEmailVerificationNotification()
Copy file name to clipboardExpand all lines: docs/docs/4.0/quickstart.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,9 @@ One important configuration is the restify default middlewares:
72
72
73
73
### Sanctum authorization
74
74
75
-
Usually you want to authorize your api (allow access only to authenticated users). For this purpose you can simply add another middleware. For the `sanctum`, Restify provides `Binaryk\LaravelRestify\Http\Middleware\RestifySanctumAuthenticate` middleware.
75
+
Usually you want to authorize your api (allow access only to authenticated users). For this purpose you can simply add another middleware. For the `sanctum`, Restify provides `Binaryk\LaravelRestify\Http\Middleware\RestifySanctumAuthenticate::class` middleware. Make sure you put this right after `api` middleware.
76
+
77
+
You may notice that Restify also use the `EnsureJsonApiHeaderMiddleware` middleware, which enforce you to use the `application/vnd.api+json` Accept header for your API requests. So make sure, even when using Postman (or something else) for making requests, that this `Accept header` is applied.
| POST |`/api/restify/posts/{post}`|partial of full update including attachments|
63
63
| DELETE |`/api/restify/posts/{post}`| destroy |
64
64
65
65
:::tip Update with files As you can see we provide 3 Verbs for the model update (PUT, PATCH, POST), the reason of that
@@ -195,14 +195,14 @@ You can customize the `meta` by creating your own `resolveShowMeta` method:
195
195
}
196
196
```
197
197
198
-
:::tip Resource property In the previous example we have used the `$this->resource` call, well, keep in mind, that you
198
+
:::tip $resource property
199
+
In the previous example we have used the `$this->resource` call, well, keep in mind, that you
199
200
always have access to the current resource in your not static methods of the repository, were the resource is the actual
200
201
current model. In the case above, the `$this->resource` represents the `Post` model with the `id=1`, because we're
201
202
looking for the route: `/api/restify/posts/1`. A similar way to get the model is the `$this->model()` method.
202
203
:::
203
204
204
-
Well, a lot of methods to modify the serialization partials, however, you are free to customize the entire response at
205
-
once by defining:
205
+
As we saw before, there are many ways to partially modify the response (ie separate way to modify meta), however, you are free to customize the entire response at once by defining:
0 commit comments