Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
<?php
|
|
2 |
|
|
3 |
namespace Nuwave\Lighthouse\Schema\Directives; |
|
4 |
|
|
5 |
use Nuwave\Lighthouse\Support\Contracts\FieldManipulator; |
|
6 |
|
|
7 |
class BelongsToManyDirective extends RelationDirective implements FieldManipulator |
|
8 |
{
|
|
9 | 1 |
public static function definition(): string |
10 |
{
|
|
11 |
return /** @lang GraphQL */ <<<'GRAPHQL' |
|
12 | 1 |
"""
|
13 |
Resolves a field through the Eloquent `BelongsToMany` relationship.
|
|
14 |
"""
|
|
15 |
directive @belongsToMany(
|
|
16 |
"""
|
|
17 |
Specify the relationship method name in the model class,
|
|
18 |
if it is named different from the field in the schema.
|
|
19 |
"""
|
|
20 |
relation: String
|
|
21 |
|
|
22 |
"""
|
|
23 |
Apply scopes to the underlying query.
|
|
24 |
"""
|
|
25 |
scopes: [String!]
|
|
26 |
|
|
27 |
"""
|
|
28 |
Allows to resolve the relation as a paginated list.
|
|
29 |
"""
|
|
30 |
type: BelongsToManyType
|
|
31 |
|
|
32 |
"""
|
|
33 |
Allow clients to query paginated lists without specifying the amount of items.
|
|
34 |
Overrules the `pagination.default_count` setting from `lighthouse.php`.
|
|
35 |
"""
|
|
36 |
defaultCount: Int
|
|
37 |
|
|
38 |
"""
|
|
39 |
Limit the maximum amount of items that clients can request from paginated lists.
|
|
40 |
Overrules the `pagination.max_count` setting from `lighthouse.php`.
|
|
41 |
"""
|
|
42 |
maxCount: Int
|
|
43 |
|
|
44 |
"""
|
|
45 |
Specify a custom type that implements the Edge interface
|
|
46 |
to extend edge object.
|
|
47 |
Only applies when using Relay style "connection" pagination.
|
|
48 |
"""
|
|
49 |
edgeType: String
|
|
50 |
) on FIELD_DEFINITION
|
|
51 |
|
|
52 |
"""
|
|
53 |
Options for the `type` argument of `@belongsToMany`.
|
|
54 |
"""
|
|
55 |
enum BelongsToManyType {
|
|
56 |
"""
|
|
57 |
Offset-based pagination, similar to the Laravel default.
|
|
58 |
"""
|
|
59 |
PAGINATOR
|
|
60 |
|
|
61 |
"""
|
|
62 |
Cursor-based pagination, compatible with the Relay specification.
|
|
63 |
"""
|
|
64 |
CONNECTION
|
|
65 |
}
|
|
66 |
GRAPHQL; |
|
67 |
}
|
|
68 |
}
|
Read our documentation on viewing source code .