name ?? Str::camel($this->column); } public function getColumn(): string { return $this->column; } public function description(): string { return ''; } public function type(): Type { $baseType = $this->baseType(); $type = $baseType instanceof BaseType ? GraphQL::type($baseType->getName()) : $baseType; if (! $this->nullable) { return Type::nonNull($type); } return $type; } /** * The arguments of the type. * * @return Argument[] */ public function arguments(): array { return []; } /** * @return array> */ public function args(): array { return collect($this->arguments()) ->mapWithKeys(fn (Argument $argument): array => [ $argument->getName() => [ 'name' => $argument->getName(), 'type' => $argument->getType(), ...(is_null($argument->getDefaultValue()) ? [] : ['defaultValue' => $argument->getDefaultValue()]), ], ]) ->toArray(); } abstract public function baseType(): Type|BaseType; public function resolve($root, array $args, $context, ResolveInfo $resolveInfo): mixed { return Arr::get($root, $this->column); } }