mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-25 08:14:29 +02:00
27 lines
674 B
PHP
27 lines
674 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Argument;
|
|
|
|
use GraphQL\Type\Definition\Type;
|
|
use Illuminate\Support\Facades\Config;
|
|
|
|
class FirstArgument extends Argument
|
|
{
|
|
public function __construct(bool $isRelation = false)
|
|
{
|
|
parent::__construct('first', Type::int());
|
|
|
|
$this->required();
|
|
|
|
// Default count set to unlimited for relations for everyone
|
|
// and set to config value for pagination queries.
|
|
$this->withDefaultValue(
|
|
$isRelation
|
|
? Config::get('graphql.pagination_values.relation.default_count')
|
|
: Config::get('graphql.pagination_values.default_count')
|
|
);
|
|
}
|
|
}
|