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

Modify BelongsTo field options from other BelongsTo #45

Closed
Krato opened this issue Aug 23, 2018 · 2 comments
Closed

Modify BelongsTo field options from other BelongsTo #45

Krato opened this issue Aug 23, 2018 · 2 comments

Comments

@Krato
Copy link

Krato commented Aug 23, 2018

Hello! I'm trying to do a multilanguage crud. So I create a Post resource and PostTranslation resource.

Post resource has:

HasMany::make('postTranslations')

PostTranslation resource has:

BelongsTo::make('Post')->sortable(),
BelongsTo::make('Locale')->sortable(),

Everything is working fine. But, how can I limit the locales select. For example:

I create a Post with ID 1. Then I create a Post with English Locale. So the next time I want to create a translation for Post ID 1, English should be disabled, because there is a translation made it.

How can achieve that with Nova?

Thanks

@devmsh
Copy link

devmsh commented Aug 27, 2018

I think you can achieve this using Validation Rules, I don't know if there is any possibility to customized the select element result query of BelongsTo relationship.

Why not to use the nova-translatable fields instead?

@davidhemphill
Copy link
Contributor

This issue board is for tracking bugs and feature requests. Please direct general questions to #nova on Laravel's Discord or #nova on the Larachat Slack Channel.

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