Multiple fields in one column
Hello, I'm looking for a way to combine 2 fields into a single column, I have a date and time in a separate DB columns but would like to show them as single table column, ie "date - time" kind of layout
Thank you!
Solution:Jump to solution
I think you can use the state method on the input, like so:
Tables\Columns\TextColumn::make('date-time')
->getStateUsing(function (Model $record): string {
return $record->date . $record->time;
})...
5 Replies
Solution
I think you can use the state method on the input, like so:
Tables\Columns\TextColumn::make('date-time')
->getStateUsing(function (Model $record): string {
return $record->date . $record->time;
})
Sorry I'm on the phone
Yes, it worked as I wanted. Thank you very much!
No prob! Don't forget to mark it as the solution and solved π happy coding