Show hidden model attributes
What I am trying to do:
I am trying to show hidden model attributes in form.
What I did:
Searched whole documentation and searched here in questions, but still can't solve it.
My issue/the error:
Hidden attributes is not accessible trough form. Is there any way make it visible like in Laravel when using
$model->makeVisible(['provider_id', 'provider'])
?
Code:
// Model
// Filament form
5 Replies
I'm facing the same issue with few hidden fields , is there no way to display them?
I tried to use makeVisible() in getModel and getEloquentQuery but I don't think thats possible.
Also $form->makeVisible() is not working
$form->getRecord()->setVisible(['name']) does set the record to have it visible, but filament still wont show it
The above solution does not show the name when doing toArray() to test, but this does
$form->getRecord()->makeVisible(['name']);
but filament still wont show itSolution
Try this:
Of course, you need to replace the Model with your specified model. π
let me do a quick test
wouldnt this work
Both methods work, thanks i will probably stick with Sector's suggestion because it feels more readable
@Michalsince u made the help card i suppose its resolved now ^^
Thanks again to both of you
Thank you, my solution was creating a resource and made the attributes visible π