kirschbaum-development / nova-inline-relationship

A package to present relationships as inline properties in Nova.
MIT License
196 stars 84 forks source link

hideFromIndex() doesn't work with relation fields marked as inline() #20

Closed tumainimosha closed 4 years ago

tumainimosha commented 4 years ago

I have an inline relationship on a nova resource that I would like to hide from displaying on index.

This is what I implemented

 BelongsTo::make('Solution', 'solution', Solution::class)
        ->hideFromIndex()
        ->inline()
        ->updateRules('sometimes'),

However, the field is still visible on index.

On commenting out the inline() method call, it works as expected by removing the field from index view.

This seems to be related to issue #19 on controlling visibility of inline relation field

Medalink commented 4 years ago

A work-a-round for this is to chain inline before you hide:

HasMany::make('Options', 'options', Option::class) ->inline() ->hideFromIndex(),

That works for me!