public function fields(): array
{
return [
'id' => [
'type' => Type::nonNull(Type::id()),
'description' => 'id'
],
'nickname' => [
'type' => Type::nonNull(Type::string()),
'description' => 'nickname'
],
'telephone' => [
'type' => Type::string(),
'description' => 'telephone',
],
'username' => [
'type' => Type::string(),
'description' => 'username'
],
'email' => [
'type' => Type::string(),
'description' => 'email',
'resolve' => function ($root) {
return Str::lower($root->email);
},
'privacy' => function () {
return false;
}
],
];
}
The privacy is not work whatever the function return true or false. Where did i go wrong?

This is the request

This relation query is not working, it is seem query not be called.
I think you're not using SelectFields, which is required to make all this magic work. Can you show your resolver?
Check the readme, lots of SelectFields examples
@mfn thank you very much, i got it.
It work fine now, thank you.
$fields = $getSelectFields();
$select = $fields->getSelect();
$with = $fields->getRelations();
$builder = User::select($select)->with($with);
Those code must be write to `UserQuery.php@resolve'
Most helpful comment
@mfn thank you very much, i got it.
It work fine now, thank you.
Those code must be write to `UserQuery.php@resolve'