Skip to content

Commit

Permalink
added required filed types on Type
Browse files Browse the repository at this point in the history
  • Loading branch information
saqueib committed Aug 30, 2017
1 parent 0d45544 commit 12a9d29
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
23 changes: 22 additions & 1 deletion app/GraphQL/Type/TweetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,31 @@ public function fields()
'likes_count' => [
'type' => Type::int()
],

// Nested Resource
'user' => [
'type' => GraphQL::type('User')
],
'replies' => [
'args' => [
'id' => [
'type' => Type::int(),
],
'first' => [
'type' => Type::int(),
],
],
'type' => Type::listOf(GraphQL::type('Reply')),
],
'likes' => [
'args' => [
'id' => [
'type' => Type::int(),
],
'first' => [
'type' => Type::int(),
],
],
'type' => Type::listOf(GraphQL::type('Like')),
]
];
}
Expand Down
40 changes: 39 additions & 1 deletion app/GraphQL/Type/UserType.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,49 @@ public function fields()
],
'is_following' => [
'type' => Type::boolean()
],
'is_followed' => [
'type' => Type::boolean()
],
'tweets' => [
'args' => [
'id' => [
'type' => Type::int(),
],
'first' => [
'type' => Type::int(),
],
],
'type' => Type::listOf(GraphQL::type('Tweet'))
],
'profile' => [
'type' => GraphQL::type('Profile')
],
'followers' => [
'args' => [
'id' => [
'type' => Type::int(),
],
'first' => [
'type' => Type::int(),
],
],
'type' => Type::listOf(GraphQL::type('User'))
],
'following' => [
'args' => [
'id' => [
'type' => Type::int(),
],
'first' => [
'type' => Type::int(),
],
],
'type' => Type::listOf(GraphQL::type('User'))
]
];
}


// If you want to resolve the field yourself, you can declare a method
// with the following format resolve[FIELD_NAME]Field()
protected function resolveEmailField($root, $args)
Expand Down

0 comments on commit 12a9d29

Please sign in to comment.