diff --git a/docs/resources.md b/docs/resources.md index cb10348b..378c7a3d 100644 --- a/docs/resources.md +++ b/docs/resources.md @@ -126,7 +126,7 @@ You may also run this same command for all resources: php please runway:generate-blueprints ``` -### Storing blueprint fields in a JSON column +### Nesting fields inside JSON columns To avoid creating a migration for every new field you add to a blueprint, fields can be stored within a JSON column. To do so, use the `->` symbol within the field handle: @@ -152,7 +152,7 @@ protected $casts = [ ]; ``` -Please note generating a migration from a blueprint configured in this way is **not** currently supported. +> **Note:** Currently, Nested Fields aren't be available in GraphQL & aren't supported by the [migration generator](#generating-migrations-from-your-blueprints) command. ## Configuring resources diff --git a/src/GraphQL/ResourceType.php b/src/GraphQL/ResourceType.php index beab7f77..f1aef880 100644 --- a/src/GraphQL/ResourceType.php +++ b/src/GraphQL/ResourceType.php @@ -25,6 +25,8 @@ public function fields(): array ->mapWithKeys(fn ($value, $key) => [ Str::replace('_id', '', $key) => $value, ]) + // TODO: Make nested fields work with GraphQL + ->reject(fn ($value, $key) => str_contains($key, '->')) ->map(function ($arr) { if (is_array($arr)) { $arr['resolve'] ??= $this->resolver();