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