Your application should use the Laravel Provider
composer require serafim/railt-authorization
- Add into
config/railt.php
:
...
'extensions' => [
\Serafim\RailtAuthorization\AuthorizationExtension::class,
]
The field that contains the directive @auth
is only available to an authenticated user.
type Example {
field: Result! @auth
}
The field that contains the directive @guest
is only available to a guest (non-authenticated user).
type Example {
field: Result! @guest
}
The field that contains the directive @can(role: String!)
:
- Is only available to an authenticated user.
- Should pass the authorization gate defined in
role
argument.
type Example {
field: Result! @can(role: "some")
}