How to show a hidden field of a related model in a Fieldset

I have a Fieldset::make()->relationship('user')->... and one of the fields on the User model is hidden by default (e.g. is in the $hidden array) that I want to specifically make visible to a Filament view/edit page. I don't see a modifyQueryUsing method or anything similar so I'm wondering how I can modify the query to make that field visible. Is this even possible?
Solution:
Ok, it's not pretty but the solution I came up with is in the form() method of the resource, I just do this: ```php /** @var Person $record */ $record = $schema->getRecord();...
Jump to solution
1 Reply
Solution
nexxai
nexxai2w ago
Ok, it's not pretty but the solution I came up with is in the form() method of the resource, I just do this:
/** @var Person $record */
$record = $schema->getRecord();

if ($record) {
$record->load('member');
$record->member->makeVisible('email');
}
/** @var Person $record */
$record = $schema->getRecord();

if ($record) {
$record->load('member');
$record->member->makeVisible('email');
}
If anyone in the future sees this and finds a more elegant way to deal with it, please respond here but for now, this seems to work.

Did you find this page helpful?