mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-20 03:17:43 +02:00
36 lines
992 B
PHP
36 lines
992 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Definition\Input\Relations;
|
|
|
|
use App\GraphQL\Definition\Input\Input;
|
|
use App\GraphQL\Definition\Types\EloquentType;
|
|
use App\GraphQL\Support\InputField;
|
|
use GraphQL\Type\Definition\Type;
|
|
|
|
class CreateHasManyInput extends Input
|
|
{
|
|
public function __construct(
|
|
protected EloquentType $type,
|
|
) {
|
|
parent::__construct("Create{$type->getName()}HasMany");
|
|
}
|
|
|
|
/**
|
|
* The input fields.
|
|
*
|
|
* @return InputField[]
|
|
*/
|
|
public function fields(): array
|
|
{
|
|
return [
|
|
new InputField('create', "[Create{$this->type->getName()}Input!]"),
|
|
new InputField('update', "[Update{$this->type->getName()}Input!]"),
|
|
new InputField('connect', Type::listof(Type::nonNull(Type::int()))),
|
|
new InputField('disconnect', Type::listof(Type::nonNull(Type::int()))),
|
|
new InputField('delete', Type::listof(Type::nonNull(Type::int()))),
|
|
];
|
|
}
|
|
}
|