Open danielschweiger opened 4 years ago
Same problem here! Can you fix this please !
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
it does not work with
"spatie/laravel-translatable" "spatie/nova-translatable"
it displays the json from the database.