F
Filament13mo ago
shad

Access data translation from the database from table builder

In v2 I was able to get the JSON data ( [ "en": "english title" , "ar" : "arabic title "] ) from the database in table builder as the pic shows but now this way doesn't work (still works for form builder), anyone knows the problem with v3?
No description
16 Replies
toeknee
toeknee13mo ago
Can you explain what doesn't work about it?
shad
shadOP13mo ago
it doesn't get the data it shows only the first title
shad
shadOP13mo ago
No description
shad
shadOP13mo ago
I guess the problem is with the dot notation , but in V2 I used it and it was working perfectly I would love to know if there is an alternative way to do so
mar5hall
mar5hall13mo ago
Try to comment format state Or try to use text column make just name. And then use format state
shad
shadOP13mo ago
yah I tried both but still not working
mar5hall
mar5hall13mo ago
try to dump data
shad
shadOP13mo ago
how
mar5hall
mar5hall13mo ago
fn(EducationalAdministrator $record) => dump($record)
fn(EducationalAdministrator $record) => dump($record)
or
dd($record)
dd($record)
shad
shadOP13mo ago
I tried that and the data accessed as it should but I cant render it on the table that's the problem, I couldn't call the 'name' column twice. so in v2, I was calling 'name.ar' and 'name.en' which brings me both data perfectly
mar5hall
mar5hall13mo ago
Provide a dump data
shad
shadOP13mo ago
No description
No description
shad
shadOP13mo ago
I did it with different resource , i have the problem everywhere 🤣
mar5hall
mar5hall13mo ago
One moment Yeah. That`s work for me
->state(fn($record) => $record->getTranslation('name', 'en'))
->state(fn($record) => $record->getTranslation('name', 'en'))
Try this code. And you can remove formatStateUsing
shad
shadOP13mo ago
thanks!! it worked but can I know the difference between formatStataeUsing and State?
Want results from more Discord servers?
Add your server