orlyapps / nova-belongsto-depend

Larave Nova BelongsTo Field with Dependcy
MIT License
182 stars 65 forks source link

Making nova-belongsto-depend Work With Nova Spatie Translatable #23

Closed issour closed 4 years ago

issour commented 5 years ago

Translatable::make([ NovaBelongsToDepend::make('Country', 'country') ->options(\App\Country::all()) ->rules('required'),

]),

capture d ecran 2018-11-13 a 23 02 41
cord commented 5 years ago

same here!

rybakk commented 5 years ago

you can work around the problem by generating a custom object array like this: $typesArray = []; foreach (EntityType::all() as $entityType) { $type = new \stdClass(); $type->id = $entityType->id; $type->name = $entityType->name; $typesArray[] = $type; } NovaBelongsToDepend::make(__('Entity Type'), 'type')->options($typesArray)

shahabzebare commented 4 years ago

public function getNameAttribute() { return $this->getTranslations('name')[app()->getLocale()]; }