`visible()` doesn't resolve record
I have the following Table
Which throws the following error
Am I missing something? It doesn't matter what type of column I use BTW, when I pass a closure to the
visible
method, it doesn't pass he record as expected.
Everything is up-to-date (LW 3.3, Filament 3.1.23)Solution:Jump to solution
In this case the check was on the user but I see what you mean.
I can achieve the same result by either using the
trueIcon()/falseIcon()
class or by conditionally adding the column. I just thought using visible
would be cleaner.
Thank you both for your time πββοΈ...3 Replies
It appears that
visible()
isn't one of the methods that Filament sees as needing to inject the row's $record or the cell's $state.
It does, however, let you run unrelated commands though: visible(auth()->user()->can('foo))
, etc.
However, this does appear to work:
... which is more about the Table, than about the Record.It doesn't make sense to hide single columns based on the record, that's why it's not injected. It would break the table structure if some rows had more columns than others.
Solution
In this case the check was on the user but I see what you mean.
I can achieve the same result by either using the
trueIcon()/falseIcon()
class or by conditionally adding the column. I just thought using visible
would be cleaner.
Thank you both for your time πββοΈ