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

32 lines
550 B
PHP

<?php
declare(strict_types=1);
namespace App\GraphQL\Support\Relations;
use App\Enums\GraphQL\RelationType;
use GraphQL\Type\Definition\Type;
class MorphToRelation 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::MORPH_TO;
}
}