TextColumn displaying custom output
So in this project of mine, I want to store 3-5 user ids (foreign key) into an array and then possibly list the names attach to these ids into one column. In the filament demo page under the posts tab, there is a column of commented authors which lists several names but I know that is connected to another table in of it self. Is it possible to do it a simpler way or do I have to do what the demo did?
6 Replies
See the demo repo on : https://github.com/filamentphp/demo
Textcolumn : https://github.com/filamentphp/demo/blob/a940c5a2c26a2a943273c526127a90c03ced6567/app/Filament/Resources/Blog/PostResource.php#L125-L129
Model : https://github.com/filamentphp/demo/blob/a940c5a2c26a2a943273c526127a90c03ced6567/app/Models/Blog/Post.php#L39-L42
I am aware of the repo and saw that it was related to another table under posts which is why I was wondering if there is a workaround for it without making a new model and resource
as for this I dont know fully how to use it yet for an array pr at least to check 3 seperate columns
TextColumn::make(‘users.name’)->listWithLineBreaks()
Assuming you have a users relationship on the model.
users relationship is just one
I have 3 seperate relationships that need to be in one text column named users, secondUser, and thirdUser
So, create a fake column.
Something like that.