Add relation in select menu
Hey folks, i have 2 models coupons and users and each coupons belongsTo one user and each user have firstname and surname so i want to create a select menu contain users firstname and surname i tried to use this
but it keep return null in create and return coupon record not user in edit
Solution:Jump to solution
@Neamix you should use
getOptionLabelFromRecordUsing()
Here's the example from one of our tutorials:
```...4 Replies
I hope this helps, an example I how I did something similar (if I understand what you are doing right. I am sure there is a much better way.
Solution
@Neamix you should use
getOptionLabelFromRecordUsing()
Here's the example from one of our tutorials:
And yeah, don't forget
->searchable(['first_name', 'last_name'])
That is so much cleaner than my way XD