Skip to content

Respect $hidden, $visible, and $appends on model components#33

Merged
joetannenbaum merged 1 commit into
mainfrom
respect-hidden-visible-appends
May 12, 2026
Merged

Respect $hidden, $visible, and $appends on model components#33
joetannenbaum merged 1 commit into
mainfrom
respect-hidden-visible-appends

Conversation

@joetannenbaum
Copy link
Copy Markdown
Collaborator

Surfaces the three Eloquent serialization-control properties on the Model component and adds a visibleProperties() helper that applies them: $visible acts as a whitelist when set, otherwise $hidden filters the keys out. Operates over merged attributes + relations since Eloquent's $hidden/$visible apply to relationships as well as columns.

Values are read via reflection on the model's default properties because a docblock @var (which the Laravel skeleton ships on $hidden) causes Surveyor to keep the typed array shape and discard the literal items. The existing $with extraction is moved to the same approach so it isn't silently broken by the same docblock pattern.

Closes laravel/wayfinder#135

@joetannenbaum joetannenbaum merged commit 5edea24 into main May 12, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dev-next] Take Eloquent's $hidden definition into account

1 participant