mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-27 17:24:42 +02:00
34 lines
716 B
PHP
34 lines
716 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Schema\Fields\Base;
|
|
|
|
use App\Contracts\GraphQL\Fields\BindableField;
|
|
use App\GraphQL\Schema\Fields\IntField;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class IdField extends IntField implements BindableField
|
|
{
|
|
/**
|
|
* @param class-string<Model> $model
|
|
*/
|
|
public function __construct(protected string $column, protected string $model)
|
|
{
|
|
parent::__construct($column, 'id', false);
|
|
}
|
|
|
|
public function description(): string
|
|
{
|
|
return 'The primary key of the resource';
|
|
}
|
|
|
|
/**
|
|
* The resolver to cast the model.
|
|
*/
|
|
public function bindResolver(array $args): null
|
|
{
|
|
return null;
|
|
}
|
|
}
|