# Relay

# Cursor Connection

Relay requires a particular kind of pagination which is the Cursor Connection To get a relay-compatible connection on a root query field, use the @paginate directive with the pagination type connection.

type Query {
  users: [User!]! @paginate(type: "connection")
}

This automatically converts the type definition into a relay connection and constructs the appropriate queries via the underlying Eloquent model.

Connections can also be used for sub-fields of a type, given they are defined as a HasMany-Relationship in Eloquent. Use the @hasMany directive.

type User {
  name: String
  posts: [Post!]! @hasMany(type: "connection")
}

# Global Object Identification

You may rebind the \Nuwave\Lighthouse\Support\Contracts\GlobalId interface to add your own mechanism of encoding/decoding global ids.

Global Object Identification

@model

@globalId

# Input Object Mutations

Lighthouse makes it easy to follow the principle of using a single field argument called input, just use the @spread directive.

type Mutation {
  introduceShip(input: IntroduceShipInput! @spread): IntroduceShipPayload!
}