-
Notifications
You must be signed in to change notification settings - Fork 84
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
make optionsLabel able to use nested object key #40
Conversation
First of all thank you for your contribution, could you make Readme about this? after that i will be able to merge this |
done ✅ |
This doesn't seem to fix the issue in FormField. |
@SimonBarrettACT make sure you use the |
My model was already set up as you suggested and this is my field entry: BelongsToManyField::make('Towns', 'towns', 'App\Nova\Town')->optionsLabel('name.en') but nothing is being displayed. |
I'm not sure what you mean by:
|
Sorry, my mistake I meant the trait in the model as shown in the picture I am not sure why it is not working with you |
It's strange. I can't see why it isn't working either. Thanks for your efforts to help though. |
I wish I could help, |
@LouisHrg |
Nope it works fine, I'll try to fix the issue in a PR today, the issue seems to be in setInitialValue in FormField.vue Update : here's the PR ahmedsayedabdelsalam#1 let me know 👍 |
I was having the same issue and have submitted a pull request #54 that fixes the issue by providing the ability to set the language used. |
fix form field
@LouisHrg @SimonBarrettACT kindly recheck if it works now. |
It works for me thanks. |
@SimonBarrettACT Great 👌 @Benjacho waiting for your review. |
Works perfectly fine for me, too. Any chance this will be merged to the main repo in the near future? ;) |
Already merged ty |
I use spatie translation package and I think many of us do
the translation columns are of json datatype like name = {"en": "dog", "de": "hund"}
I find that the form select input works well but the index and details pages are not working
![Screen Shot 2020-07-17 at 1 57 36 AM](https://user-images.githubusercontent.com/29691074/87734302-8cf2bf80-c7d2-11ea-9244-046b760bd1a0.png)
optionsLable('name')
also when setting optionsLabel like this
![Screen Shot 2020-07-17 at 1 57 17 AM](https://user-images.githubusercontent.com/29691074/87734074-e4dcf680-c7d1-11ea-8145-d3ea728ed67e.png)
optionsLabel('name.en')
I know we could make a computed attribute for that but it's painful to add those custom attributes everywhere.
I think making it can access nested key from object like
![Screen Shot 2020-07-17 at 1 55 09 AM](https://user-images.githubusercontent.com/29691074/87734345-a7c53400-c7d2-11ea-8f30-868767e84a3a.png)
optionsLabel('name.en')
well be very helpful