© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
Wim

Filament table: related resource with traits

I'm trying to use Laravel-Vouchers in Filament PHP. I have two models: User (implements CanRedeemVouchers) and Product (implement HasVoucher). I cannot 'see' the model Voucher as this is part of the package. So I cannot manually add a relation to between Product and Voucher (however this should be covered by the traits).

I created a form where I can add vouchers and assign them to a product. This created an entry in the voucher table:
id:1
code: AAAABBBBCCCC
model_type: App\Models\Product
model_id: 1
expires_at: 2024-1-18
id:1
code: AAAABBBBCCCC
model_type: App\Models\Product
model_id: 1
expires_at: 2024-1-18

In a Filament table 'Vouchers' I would like to display the product name.

I was trying as follows:

Tables\Columns\TextColumn::make('name')
    ->default(function (Product $record) {
         return $record->name;
    }),
Tables\Columns\TextColumn::make('name')
    ->default(function (Product $record) {
         return $record->name;
    }),

But this clearly is not the right way. Anyone can provide little help?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Set table to use for filament resource
FilamentFFilament / ❓┊help
16mo ago
Testing filament resource table got an error
FilamentFFilament / ❓┊help
2y ago
Filament Page with Table
FilamentFFilament / ❓┊help
2y ago
Filament Table With default ?
FilamentFFilament / ❓┊help
3y ago