Malja
Searchable select using model's attribute as label
Hi all,
I have a model
Do you have any suggestions? Thank you.
Pet
, that belongs to User
:
However, I have a problem creating a new Pet for a specific User:
The problem is, that no matter what I do in getSearchResultsUsing
and getOptionLabelUsing
, I won't get User's fullName
to be shown. I tried:
- Using pluck('last_name', 'id')
instead of get
. This shows the last_name
, but getOptionLabelUsing
is not called.
- Using relationship('owner', 'last_name')
. This does not allow using fullName
instead of lastName
.Do you have any suggestions? Thank you.
2 replies
Use `relationship()` when creating a new record
Hi all,
I have two tables,
consumers
and addresses
. The consumer has a address_id
column:
And addresses
table looks like this:
When I use relationship
method to create Address for Consumer:
then the Address is not created. In addition, when I use the handleRecordCreation
method, I don't see any address-related data in there. Only data for Customer.
Does the relationship()
method work for creating new records? Where could be the problem?
Thank you in advance.14 replies