mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-22 04:16:05 +02:00
44 lines
946 B
PHP
44 lines
946 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Schema\Fields;
|
|
|
|
use App\Contracts\GraphQL\Fields\DisplayableField;
|
|
use App\Contracts\GraphQL\Fields\FilterableField;
|
|
use App\Contracts\GraphQL\Fields\SortableField;
|
|
use App\Enums\GraphQL\SortType;
|
|
use App\GraphQL\Support\Filter\EqFilter;
|
|
use App\GraphQL\Support\Filter\Filter;
|
|
use App\GraphQL\Support\Filter\LikeFilter;
|
|
use GraphQL\Type\Definition\Type;
|
|
|
|
abstract class StringField extends Field implements DisplayableField, FilterableField, SortableField
|
|
{
|
|
public function baseType(): Type
|
|
{
|
|
return Type::string();
|
|
}
|
|
|
|
public function canBeDisplayed(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return Filter[]
|
|
*/
|
|
public function getFilters(): array
|
|
{
|
|
return [
|
|
new EqFilter($this),
|
|
new LikeFilter($this),
|
|
];
|
|
}
|
|
|
|
public function sortType(): SortType
|
|
{
|
|
return SortType::ROOT;
|
|
}
|
|
}
|