Files
animethemes-server/app/GraphQL/Support/Relations/HasOneRelation.php
T

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;
}
}