Add data
json string property to models with additional data
This commit is contained in:
parent
b09e5aac8a
commit
2eb74d2898
1 changed files with 8 additions and 0 deletions
|
@ -120,6 +120,14 @@ class Builder
|
||||||
$name = $model->getType();
|
$name = $model->getType();
|
||||||
$fields = [];
|
$fields = [];
|
||||||
|
|
||||||
|
if ($model->isAny()) {
|
||||||
|
$fields['data'] = [
|
||||||
|
'type' => Type::string(),
|
||||||
|
'description' => 'Data field',
|
||||||
|
'resolve' => fn($object, $args, $context, $info) => json_encode($object, JSON_FORCE_OBJECT),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($rules as $key => $props) {
|
foreach ($rules as $key => $props) {
|
||||||
$escapedKey = str_replace('$', '_', $key);
|
$escapedKey = str_replace('$', '_', $key);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue