mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
44 lines
975 B
PHP
44 lines
975 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Definition\Fields\Search;
|
|
|
|
use App\Contracts\GraphQL\Fields\DisplayableField;
|
|
use App\GraphQL\Definition\Fields\Field;
|
|
use App\GraphQL\Definition\Types\Wiki\SongType;
|
|
use GraphQL\Type\Definition\Type;
|
|
use Rebing\GraphQL\Support\Facades\GraphQL;
|
|
|
|
class SearchSongsField extends Field implements DisplayableField
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct('songs', nullable: false);
|
|
}
|
|
|
|
/**
|
|
* The description of the field.
|
|
*/
|
|
public function description(): string
|
|
{
|
|
return 'The song results of the search';
|
|
}
|
|
|
|
/**
|
|
* The type returned by the field.
|
|
*/
|
|
public function baseType(): Type
|
|
{
|
|
return Type::listOf(Type::nonNull(GraphQL::type(new SongType()->getName())));
|
|
}
|
|
|
|
/**
|
|
* Determine if the field should be displayed to the user.
|
|
*/
|
|
public function canBeDisplayed(): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|