F
Filamentβ€’11mo ago
D2RTECH

how to show the mobile number with country code

I want to combine values of two table columns and show them in the one column. how do i acheive that?
Solution:
Build a virtual column if it's a list view?
TextColumn('full_number')->formatStateUsing(fn($record) => '+' . $record->area_code . $record->phone_number)
TextColumn('full_number')->formatStateUsing(fn($record) => '+' . $record->area_code . $record->phone_number)
...
Jump to solution
4 Replies
D2RTECH
D2RTECHOPβ€’11mo ago
Basically need to concatenate both of them and prefix them with a + sign kindly help
justlasse
justlasseβ€’11mo ago
How are you storing them in the db or model?
Solution
toeknee
toekneeβ€’11mo ago
Build a virtual column if it's a list view?
TextColumn('full_number')->formatStateUsing(fn($record) => '+' . $record->area_code . $record->phone_number)
TextColumn('full_number')->formatStateUsing(fn($record) => '+' . $record->area_code . $record->phone_number)
D2RTECH
D2RTECHOPβ€’11mo ago
country code and mobile number are store differently in the db table this worked πŸ™‚
Want results from more Discord servers?
Add your server