© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
5 replies
Sujay Barma

Add condition if column value blank in table

In Resource I have a form with label 'Download Url' the field is not manditory. So, when the user doesn't add any value to this field I would like show other field value in place in Table. Any idea on how to achieve it?
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('download_url')->label('Filename')
->formatStateUsing(function($record) {
    if($record->download_url != '')
    {
        return $record->download_url;
    }
    else
    {
       return $record->name;
    }
}),
Tables\Columns\TextColumn::make('caption'), 
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('download_url')->label('Filename')
->formatStateUsing(function($record) {
    if($record->download_url != '')
    {
        return $record->download_url;
    }
    else
    {
       return $record->name;
    }
}),
Tables\Columns\TextColumn::make('caption'), 
Video_table.png
Solution
use
state
state
instead of formatStateUsing
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Translate table column value
FilamentFFilament / ❓┊help
3y ago
Filament Table column hidden with condition
FilamentFFilament / ❓┊help
3y ago
Table Column for json value
FilamentFFilament / ❓┊help
3y ago
Cannot show value from pivot table in table builder column?
FilamentFFilament / ❓┊help
3y ago