F
Filament15mo 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
D2RTECHOP15mo ago
Basically need to concatenate both of them and prefix them with a + sign kindly help
justlasse
justlasse15mo ago
How are you storing them in the db or model?
Solution
toeknee
toeknee15mo 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
D2RTECHOP15mo ago
country code and mobile number are store differently in the db table this worked 🙂

Did you find this page helpful?