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
protected $hidden = ['provider', 'provider_id', 'content_id'];


// Filament form
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make("title"),
                TextInput::make("poster_image"),
                TextInput::make("type"),
                TextInput::make("provider"),
                TextInput::make("provider_id"),
            ]);
    }
Solution
Try this:
TextInput::make('provider')
 ->visibleOn('view')
 ->formatStateUsing(fn (Model $item) => $item->provider),


Of course, you need to replace the Model with your specified model. 🙂
Was this page helpful?