1
<?php
2

3
namespace Nuwave\Lighthouse\Schema\Directives;
4

5
class HasOneDirective extends RelationDirective
6
{
7 1
    public static function definition(): string
8
    {
9
        return /** @lang GraphQL */ <<<'GRAPHQL'
10 1
"""
11
Corresponds to [the Eloquent relationship HasOne](https://laravel.com/docs/eloquent-relationships#one-to-one).
12
"""
13
directive @hasOne(
14
  """
15
  Specify the relationship method name in the model class,
16
  if it is named different from the field in the schema.
17
  """
18
  relation: String
19

20
  """
21
  Apply scopes to the underlying query.
22
  """
23
  scopes: [String!]
24
) on FIELD_DEFINITION
25
GRAPHQL;
26
    }
27
}

Read our documentation on viewing source code .

Loading