mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-21 03:46:13 +02:00
32 lines
548 B
PHP
32 lines
548 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Support\Relations;
|
|
|
|
use App\Enums\GraphQL\RelationType;
|
|
use GraphQL\Type\Definition\Type;
|
|
|
|
class HasOneRelation extends Relation
|
|
{
|
|
/**
|
|
* The type returned by the field.
|
|
*/
|
|
public function type(): Type
|
|
{
|
|
if (! $this->nullable) {
|
|
return Type::nonNull($this->type);
|
|
}
|
|
|
|
return $this->type;
|
|
}
|
|
|
|
/**
|
|
* The Relation type.
|
|
*/
|
|
protected function relation(): RelationType
|
|
{
|
|
return RelationType::HAS_ONE;
|
|
}
|
|
}
|