I am trying to pass the correct format for GraphQL. I can get this to work through post man no issues
{
tblprojects
{
id
name
}
}
I am lost on how to apply operators, filters, etc. When I try this it gives an error
{
tblprojects (name:"Test")
{
id
name
}
}
“message”: “Unknown argument “name” on field “tblprojects” of type “Query”.”,
This is the backend
$queryFields = [];
foreach ($tables as $table) {
$queryFields[$table] = [
'type' => Type::listOf(new ObjectType([
'name' => ucfirst($table),
'fields' => function() use ($table) {
return $this->getFieldsFromTable($table);
},
])),
'args' => [
'id_in' => [
'type' => Type::listOf(Type::int()), // Allow filtering by an array of integers
],
],
'resolve' => function($root, $args) use ($table) {
if (isset($args['id_in']) && !empty($args['id_in'])) {
// Apply filtering if 'id_in' argument is passed
$this->db->where_in('id', $args['id_in']);
}
return $this->db->get($table)->result();
},
];
}
Looks like I need to pass // Apply filtering if ‘id_in’ argument is passed
How do I do this? Can you give me a few examples of applying operators and filtering etc so I can try in postman?