F
Filament9mo 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
toeknee9mo ago
Can you explain what doesn't work about it?
shad
shad9mo ago
it doesn't get the data it shows only the first title
shad
shad9mo ago
No description
shad
shad9mo 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
mar5hall9mo ago
Try to comment format state Or try to use text column make just name. And then use format state
shad
shad9mo ago
yah I tried both but still not working
mar5hall
mar5hall9mo ago
try to dump data
shad
shad9mo ago
how
mar5hall
mar5hall9mo ago
fn(EducationalAdministrator $record) => dump($record)
fn(EducationalAdministrator $record) => dump($record)
or
dd($record)
dd($record)
shad
shad9mo 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
mar5hall9mo ago
Provide a dump data
shad
shad9mo ago
No description
No description
shad
shad9mo ago
I did it with different resource , i have the problem everywhere 🤣
mar5hall
mar5hall9mo 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
shad9mo ago
thanks!! it worked but can I know the difference between formatStataeUsing and State?