F
Filament14mo ago
Oumaima

concatenate value in text column

I have a order table , which has user name Column , And I want to concatenate the firstname and lastname of this relationship , what should I do :
->columns([
Tables\Columns\TextColumn::make('user.firstname')
->label('User name'),
])
->columns([
Tables\Columns\TextColumn::make('user.firstname')
->label('User name'),
])
Relationship :
public function user(){
return $this->belongsTo(User::class);
}
public function user(){
return $this->belongsTo(User::class);
}
Solution:
```php ->columns([ Tables\Columns\TextColumn::make('user') ->label('User name'), ->formatStateUsing(fn($state) => $state.firstname . ' ' . $state->lastname)...
Jump to solution
3 Replies
Solution
toeknee
toeknee14mo ago
->columns([
Tables\Columns\TextColumn::make('user')
->label('User name'),
->formatStateUsing(fn($state) => $state.firstname . ' ' . $state->lastname)
])
->columns([
Tables\Columns\TextColumn::make('user')
->label('User name'),
->formatStateUsing(fn($state) => $state.firstname . ' ' . $state->lastname)
])
Oumaima
OumaimaOP14mo ago
thank you so much ! it worked !
toeknee
toeknee14mo ago
Welcome
Want results from more Discord servers?
Add your server