Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with translatable #69

Open
danielschweiger opened this issue Aug 16, 2020 · 2 comments
Open

issue with translatable #69

danielschweiger opened this issue Aug 16, 2020 · 2 comments

Comments

@danielschweiger
Copy link

it does not work with

"spatie/laravel-translatable"
"spatie/nova-translatable"

Bildschirmfoto 2020-08-16 um 21 03 08

it displays the json from the database.

@iveliniliev90
Copy link

Same problem here! Can you fix this please !

@vadimsauzans
Copy link

Found the solution for this using DB's json function. Haven't tested on MySQL, but work fine with Postgresql 13.

NovaBelongsToDepend::make('Group', 'group', GroupsResource::class)
                ->optionsResolve(function ($domain) {
                    return $domain->groups()->get(['id', 'translation->en as name']);
                })->dependsOn('Domain')
                ->required()

It will produce such query:

select
  "id",
  "translation" ->> 'en' as "name"
from
  "groups"
where
  "groups"."domain_id" = 1
  and "groups"."domain_id" is not null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants