Access Relationship Data in Table Layout Custom HTML

How to access relationship data in Table Layout: Custom HTML.
I have products and I want to show their variants in the custom HTML.
https://filamentphp.com/docs/3.x/tables/layout#custom-html
<?php
//Product Model
public function variants(): HasMany
    {
        return $this->hasMany(ProductVariant::class);
    }

```<?php
// ProductResource.php
View::make('products.table.collapsible-row-content')
        ->collapsible(),

<?php
// I try below code in the blade file. 
// resources/views/products/table/collapsible-row-content.blade.php
<p class="px-4 py-3 bg-gray-100 rounded-lg">
    <span class="font-medium">
      @foreach($getRecord()->variants() as  $productVariant)
            <p>{{$productVariant->description}}</p>
        @endforeach
    </span>
</p>
Was this page helpful?