phplaravel-filamentfilamentphp

How can I show related columns in a table in PHP Filament v3


I have two tables Advisors and AdvisorRegions and the relation looks like this. One advisorRegion has many advisors and one advisor has one advisorRegion.

Now I want to show the name of the advisorRegion in the advisors-resource table.

I have the advisors_region_id as an foreign key in my advisor table

How do i do this in filament php v3.

I tried to look it up but found nothng interesting at all.


Solution

  • From the Displaying data from relationships section of the docs:

    TextColumn::make('advisorsRegion.name');
    

    Where advisorsRegion is the name of the relationship in your model