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'), 
Video_table.png
Solution
use state instead of formatStateUsing
Was this page helpful?